本帖最后由 michaelcai4703 于 2016-11-1 13:26 编辑
导出的代码:
private void tsBtnExcelReport_Click(object sender, EventArgs e)
{
TabPage page = tabBody.SelectedTab;
string pageName = page.ToString();
C1FlexGrid c1FlexGrid = page.Controls[0] as C1FlexGrid;
int rowCount=c1FlexGrid.Rows.Count;
if (rowCount < 1)
{
return;
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Excel (*.xls)|*.xls";
sfd.FileName = string.Format("{0}_系统构成_{1}_{2}.xls",ProjNum, page.Text,DateTime.Now.ToString("yyyyMMddHHmmssfff"));
sfd.FileName = sfd.FileName.Replace('|', '_').Replace('/', '_');
if (sfd.ShowDialog() == DialogResult.OK)
{
FileFlags flag = new FileFlags();
flag = FileFlags.AsDisplayed | FileFlags.IncludeFixedCells | FileFlags.SaveMergedRanges;
c1FlexGrid.SaveExcel(sfd.FileName, flag);
System.Diagnostics.Process.Start(sfd.FileName);
}
}
-------------------------------------------------------------------------------------------------------------------
代码中设置了
flag = FileFlags.AsDisplayed | FileFlags.IncludeFixedCells | FileFlags.SaveMergedRanges;
显示的有边框,导出到excel中,边框丢失,不知到问题出在哪里?
|