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;
}


posted @ 2012-06-08 15:06  许阳 无锡  阅读(218)  评论(0编辑  收藏  举报