首页 / 操作系统 / Linux / C++ CLR 读取Worksheet名称
C++ CLR 读取Worksheet名称:
- // OpenXmlC.cpp : main project file.
-
- #include "stdafx.h"
-
- using namespace System;
- using namespace System::Collections::Generic;
- using namespace System::Linq;
- using namespace DocumentFormat::OpenXml::Packaging;
- using namespace DocumentFormat::OpenXml::Spreadsheet;
-
-
- int main(array<System::String ^> ^args)
- {
- SpreadsheetDocument^ ssd = SpreadsheetDocument::Open("C:\Users\v-yangxu\Desktop\ExcelTemplate11.xlsx",false);
- WorkbookPart^ wbp = ssd->WorkbookPart;
- Workbook^ wb = wbp->Workbook;
- Sheet^ sheet = Enumerable::FirstOrDefault(wb->Descendants<Sheet^>());
-
- Console::WriteLine(sheet->Name);
- Console::ReadKey();
- return 0;
- }