ワークシートから表示される行データをエクスポート
Contents
[
Hide
]
Aspose.Cells を使用してワークシートからデータテーブルにデータをエクスポートできます。時々、表示される行のデータのみをエクスポートしたい場合があります。Aspose.Cells では、これを実現する方法が用意されています。ExportTableOptions.PlotVisibleRows を使用して、表示される行のデータのみをエクスポートすることを指定します。
この例では、以下のワークシートからデータをエクスポートする方法を示しています。5行目、6行目、7行目が非表示になっています。
ワークシートのサンプルデータ、5行目、6行目、7行目が非表示です |
---|
![]() |
表示される行データのみをエクスポートする際に、データは Worksheet.Cells.ExportDataTable()メソッドと ExportTableOptions.PlotVisibleRowsオプションを使用してデータテーブルにエクスポートされます。非表示の行は空行としてプロットされます
非表示の行はデータテーブルに空行としてエクスポートされます |
---|
![]() |
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); |