1

我已经使用 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();

感谢提前

4

0 回答 0