Exportar datos de filas visibles de la hoja de trabajo
Contents
[
Hide
]
Puede exportar datos de hojas de cálculo a tablas de datos utilizando Aspose.Cells. A veces desea exportar solo los datos de filas visibles. Aspose.Cells proporciona una forma de lograr esto. Utilice el ExportTableOptions.PlotVisibleRows para especificar que desea exportar solo los datos de filas visibles.
Este ejemplo muestra cómo exportar datos de la siguiente hoja de cálculo. Las filas 5, 6 y 7 están ocultas.
Datos de ejemplo en la hoja de cálculo, las filas 5, 6 y 7 están ocultas |
---|
![]() |
Una vez que los datos se exportan a una tabla de datos utilizando el método Worksheet.Cells.ExportDataTable() con la opción ExportTableOptions.PlotVisibleRows, se verá así. Las filas ocultas se representan como filas en blanco
Las filas ocultas se exportan a la tabla de datos como filas en blanco |
---|
![]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |