データテーブルにワークシートデータをエクスポートする際に非表示の列を無視

Contents
[ ]

次のサンプルコードでは、ワークシート全体のデータをデータテーブルにエクスポートする際に非表示の列を無視する ExportTableOptions.PlotVisibleColumnsプロパティの使用方法を説明しています。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
string inputPath = dataDir + "Sample.xlsx";
Workbook workbook = new Workbook(inputPath);
Worksheet worksheet = workbook.Worksheets[0];
ExportTableOptions opts = new ExportTableOptions();
opts.PlotVisibleColumns = true;
int totalRows = worksheet.Cells.MaxRow + 1;
int totalColumns = worksheet.Cells.MaxColumn + 1;
DataTable dt = worksheet.Cells.ExportDataTable(0, 0, totalRows, totalColumns, opts);