将excel导入到WPF平台中的GcSpreadSheet控件中时,excel中原有的格式,比如背景色,没有了,导入的时候,怎么可以保留excel中所有的格式?相关代码如下:
System.IO.FileStream stream = new System.IO.FileStream(openFileDialog.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
SpreadSheet.gcSpreadSheet1.OpenExcel(stream, ExcelOpenFlags.NoFlagsSet);
int count = SpreadSheet.gcSpreadSheet1.ActiveSheet.Columns.Count;
int row = SpreadSheet.gcSpreadSheet1.ActiveSheet.Rows.Count;
SpreadSheet.gcSpreadSheet1.ActiveSheet.AddColumns(count, System.Math.Abs(500 - count));
SpreadSheet.gcSpreadSheet1.ActiveSheet.AddRows(row, System.Math.Abs(500 - row));
stream.Close();
|
|