Created
August 19, 2020 21:30
-
-
Save aspose-com-gists/2b38adfb2d3ff27c0c6ef3ee36062ce3 to your computer and use it in GitHub Desktop.
Convert Word DOCX/DOC to HTML/MHTML in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the document from | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"Test File.docx"); | |
// Save the word document in HTML format | |
doc->Save(u"Document_out.html", SaveFormat::Html); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the document into Aspose.Words. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"Test File.docx"); | |
// Save output in MHTML format. | |
doc->Save(u"Document_out.mhtml", SaveFormat::Mhtml); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load source DOCX file | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"Document.docx"); | |
// Initialize HtmlSaveOptions object | |
System::SharedPtr<HtmlSaveOptions> saveOptions = System::MakeObject<HtmlSaveOptions>(); | |
saveOptions->set_ExportFontResources(true); | |
saveOptions->set_ExportFontsAsBase64(true); | |
// Save output HTML | |
System::String outputPath = u"ExportFontsAsBase64.html"; | |
doc->Save(outputPath, saveOptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input DOCX file | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"Document.doc"); | |
// Set HtmlSaveOptions | |
System::SharedPtr<HtmlSaveOptions> saveOptions = System::MakeObject<HtmlSaveOptions>(); | |
saveOptions->set_ExportFontResources(true); | |
saveOptions->set_ExportFontsAsBase64(true); | |
// Save output HTML file | |
System::String outputPath = u"ExportFontsAsBase64.html"; | |
doc->Save(outputPath, saveOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment