我将xtragrid导出到xlsx时出现问题,垂直线不会停在最后一行,我怎么能让它们停止或我如何隐藏(垂直/水平)线。 我要导出的代码
private void btnExport_Click(object sender, EventArgs e)
{
using (SaveFileDialog saveDialog = new SaveFileDialog())
{
saveDialog.Filter = "Excel (2007-2019) (.xlsx)|*.xlsx |Word (2007-2019) (.docx)|*.docx |Pdf File (.pdf)|*.pdf |Html File (.html)|*.html";
if (saveDialog.ShowDialog() != DialogResult.Cancel)
{
string exportFilePath = saveDialog.FileName;
string fileExtenstion = new FileInfo(exportFilePath).Extension;
switch (fileExtenstion)
{
case ".xlsx":
gridControl1.ExportToXlsx(exportFilePath);
break;
case ".docx":
gridControl1.ExportToDocx(exportFilePath);
break;
case ".pdf":
gridControl1.ExportToPdf(exportFilePath);
break;
case ".html":
gridControl1.ExportToHtml(exportFilePath);
break;
default:
break;
}
}
}
答案 0 :(得分:0)
我使用LayoutMode来实现这个
if (saveDialog.ShowDialog() != DialogResult.Cancel)
{
XlsxExportOptionsEx options = new XlsxExportOptionsEx();
options.LayoutMode = DevExpress.Export.LayoutMode.Table;
string exportFilePath = saveDialog.FileName;
string fileExtenstion = new FileInfo(exportFilePath).Extension;
fileExtenstion = ".xlsx";
options.BeforeExportTable += ea => {
ea.Table.Style.Name = XlBuiltInTableStyleId.None;
};
gridControl2.ExportToXlsx(exportFilePath, options);