Control Page Layout
- A new public property
PageLayout
is added to the PdfSaveOptions
class in this release of the Aspose.Words for C++ API. PdfPageLayout
is the new pulic enumeration introduced in this release.
Using this property, you can specify the initial page layout to be used when a document is opened in a PDF reader.
Source*
Seamless Document Merging
This release introduces a new public method, Merge(Document[], MergeFormatMode)
which is added to the LowCode.Merger
class.
Merge multiple documents into a single file by inputting an array of Document objects and optimize your document automation tasks.
Please review the following C++ code example to learn more:
System::SharedPtr<Aspose::Words::DocumentBuilder> firstDoc = System::MakeObject<Aspose::Words::DocumentBuilder>();
firstDoc->get_Font()->set_Size(16);
firstDoc->get_Font()->set_Color(System::Drawing::Color::get_Blue());
firstDoc->Write(u"Hello first word!");
System::SharedPtr<Aspose::Words::DocumentBuilder> secondDoc = System::MakeObject<Aspose::Words::DocumentBuilder>();
secondDoc->Write(u"Hello second word!");
System::SharedPtr<Aspose::Words::Document> mergedDoc = Aspose::Words::LowCode::Merger::Merge(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc->get_Document(), secondDoc->get_Document()}), Aspose::Words::LowCode::MergeFormatMode::KeepSourceLayout);
ASSERT_EQ(u"Hello first word!\fHello second word!\f", mergedDoc->GetText());
Source*
WebP Image Support Introduced
Developers can now read and add WebP images within their C++ apps via the DocumentBuilder
class.
Reading or adding WebP images to your documents is easier than ever with the help of this feature addition.
The following C++ coding sample showcases how you can insert a WebP image into a document with the InsertImage
method of the DocumentBuilder
class:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage(ImageDir + "WebP image.webp");
doc.Save(ArtifactsDir + "Image.InsertWebpImage.docx");
Source*
Improved ZIP64 Handling for OOXML Documents
- Another new addition to this release of the C++ API is the public property
Zip64Mode
added to the OoxmlSaveOptions
class along with the Zip64Mode
enum.
For developers working with large files, you can control how ZIP64 format extensions are used for OOXML (output) documents.
Here’s an example C++ code demonstrating the usage of this new feature:
System::Random random;
System::SharedPtr<Aspose::Words::DocumentBuilder> builder = System::MakeObject<Aspose::Words::DocumentBuilder>();
for (int32_t i = 0; i < 10000; i++)
{
{
System::SharedPtr<System::Drawing::Bitmap> bmp = System::MakeObject<System::Drawing::Bitmap>(5, 5);
// Clearing resources under 'using' statement
System::Details::DisposeGuard<1> __dispose_guard_2({ bmp});
// ------------------------------------------
try{
System::SharedPtr<System::Drawing::Graphics> g = System::Drawing::Graphics::FromImage(bmp);
// Clearing resources under 'using' statement
System::Details::DisposeGuard<1> __dispose_guard_1({ g});
// ------------------------------------------
try
{
g->Clear(System::Drawing::Color::FromArgb(random.Next(0, 254), random.Next(0, 254), random.Next(0, 254)));
{
System::SharedPtr<System::IO::MemoryStream> ms = System::MakeObject<System::IO::MemoryStream>();
// Clearing resources under 'using' statement
System::Details::DisposeGuard<1> __dispose_guard_0({ ms});
// ------------------------------------------
try
{
bmp->Save(ms, System::Drawing::Imaging::ImageFormat::get_Png());
builder->InsertImage(ms->ToArray());
}
catch(...)
{
__dispose_guard_0.SetCurrentException(std::current_exception());
}
}
}
catch(...)
{
__dispose_guard_1.SetCurrentException(std::current_exception());
}
}
catch(...)
{
__dispose_guard_2.SetCurrentException(std::current_exception());
}
}
}
builder->get_Document()->Save(get_ArtifactsDir() + u"OoxmlSaveOptions.Zip64ModeOption.docx", [&]{ auto tmp_1 = System::MakeObject<Aspose::Words::Saving::OoxmlSaveOptions>(); tmp_1->set_Zip64Mode(Aspose::Words::Saving::Zip64Mode::Always); return tmp_1; }());
Source*
You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.Words for C++ 23.12 Release Notes.