Export Visible Rows Data from Worksheet

Contents
[ ]

This example shows how to export data from the following worksheet. Rows 5, 6 and 7 are hidden.

Sample data in worksheet, rows 5, 6 and 7 are hidden
todo:image_alt_text

Once the data is exported to a data table using the Worksheet.Cells.ExportDataTable() method with the ExportTableOptions.PlotVisibleRows option, it will look like this. Hidden rows are plotted as blank rows

Hidden rows are exported to the data table as blank rows
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);