从工作表中导出可见行数据

Contents
[ ]

此示例显示了如何从以下工作表中导出数据。第5、6和7行被隐藏。

工作表中的示例数据,第5、6和7行被隐藏
todo:image_alt_text

将数据导出到数据表后,使用Worksheet.Cells.ExportDataTable()方法和ExportTableOptions.PlotVisibleRows选项,它看起来像这样。隐藏行被绘制为空行

将隐藏行导出到数据表中作为空行
todo:image_alt_text
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
string filePath = dataDir+ "aspose-sample.xlsx";
// Load the source workbook
Workbook workbook = new Workbook(filePath);
// Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Specify export table options
ExportTableOptions exportOptions = new ExportTableOptions();
exportOptions.PlotVisibleRows = true;
exportOptions.ExportColumnName = true;
// Export the data from worksheet with export options
DataTable dataTable = worksheet.Cells.ExportDataTable(0, 0, 10, 4, exportOptions);