1.c1FlexGrid控件导入excel数据少的时候,会显示如图所示的灰色背景,如何将整个框都充满单元格,像excel那样。
2.导入时如何显示excel中的行号ABC。。和列号123。。。
代码如下
// choose file
OpenFileDialog dlg = new OpenFileDialog();
dlg.DefaultExt = "xls";
dlg.FileName = "*.xls";
if (dlg.ShowDialog() != DialogResult.OK)
return;
// clear date source
c1FlexGrid1.DataSource = null;
string[] sheets = c1FlexGrid1.LoadExcelSheetNames(dlg.FileName);
Console.WriteLine("Found {0} sheets in this book.", sheets.Length);
foreach (string sheet in sheets)
{
Console.WriteLine("- {0}", sheet);
}
// load the first sheet in the book
FileFlags flags = (checkBox1.Checked) ? FileFlags.IncludeFixedCells : FileFlags.None;
c1FlexGrid1.LoadGrid(dlg.FileName, FileFormatEnum.Excel, flags);
dlg.RestoreDirectory = true; |