用C ++创建PresentationML文档

时间:2012-11-12 13:57:46

标签: openxml presentationml

我已经使用wordprocessingML工作并取得成功,但不能使用presentationML。 我的问题是我的大小的文件是0ko,我不知道为什么。 我知道创建一个空的word文档已经足够了,但它对于一个空的powerpoint来说已经足够了吗? 我按照一些教程但没有人工作(对我而言) 创建powerpoint的好方法是什么?

我通过此恢复我的代码(我尝试创建一个空档案)

this->m_package = System::IO::Packaging::Package::Open(sPath, System::IO::FileMode::Create, System::IO::FileAccess::ReadWrite);

System::Uri ^ uriDoc = gcnew System::Uri("/ppt/presentation.xml", System::UriKind::Relative);
this->m_packagePart = this->m_package->CreatePart(uriDoc, "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml");
System::IO::StreamWriter^ streamPart = gcnew System::IO::StreamWriter(this->m_packagePart->GetStream(System::IO::FileMode::Create, System::IO::FileAccess::Write));
this->m_package->CreateRelationship(uriDoc, System::IO::Packaging::TargetMode::Internal, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", "rId1");
DocumentFormat::OpenXml::Packaging::OpenSettings^ openSet = gcnew DocumentFormat::OpenXml::Packaging::OpenSettings;
openSet->MaxCharactersInPart = 0;

this->m_presentationDoc = DocumentFormat::OpenXml::Packaging::PresentationDocument::Open(this->m_package, openSet);

this->m_presentationPart = this->m_presentationDoc->PresentationPart;
this->m_presentationPart->Presentation = gcnew DocumentFormat::OpenXml::Presentation::Presentation();

感谢您提前

0 个答案:

没有答案
相关问题