C++ CLR 读取Worksheet名称

来源:互联网 发布:数据采集与处理投稿 编辑:程序博客网 时间:2024/06/15 13:46
// 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;}


原创粉丝点击