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:\\******\\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;
}
征诛志异,三让两家王朝;功同开辟,一桮万古江南。

浙公网安备 33010602011771号