Aspose::Words::PageExtractOptions class
Contents
[
Hide
]PageExtractOptions class
Allows to specify options for document page extracting.
class PageExtractOptions : public System::Object
Methods
Method | Description |
---|---|
get_UnlinkPagesNumberFields() const | Specifies whether NUMPAGES fields in the resulting document will be replaced with their actual resulting values. Default value is true. |
get_UpdatePageStartingNumber() const | Specifies whether the start page number in the resulting document shall be updated. Default value is true. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
PageExtractOptions() | |
set_UnlinkPagesNumberFields(bool) | Setter for Aspose::Words::PageExtractOptions::get_UnlinkPagesNumberFields. |
set_UpdatePageStartingNumber(bool) | Setter for Aspose::Words::PageExtractOptions::get_UpdatePageStartingNumber. |
static Type() |
Examples
Show how to reset the initial page numbering and save the NUMPAGE field.
auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Page fields.docx");
// Default behavior:
// The extracted page numbering is the same as in the original document, as if we had selected "Print 2 pages" in MS Word.
// The start page will be set to 2 and the field indicating the number of pages will be removed
// and replaced with a constant value equal to the number of pages.
System::SharedPtr<Aspose::Words::Document> extractedDoc1 = doc->ExtractPages(1, 1);
extractedDoc1->Save(get_ArtifactsDir() + u"Document.ExtractPagesWithOptions.Default.docx");
// Altered behavior:
// The extracted page numbering is reset and a new one begins,
// as if we had copied the contents of the second page and pasted it into a new document.
// The start page will be set to 1 and the field indicating the number of pages will be left unchanged
// and will show the current number of pages.
auto extractOptions = System::MakeObject<Aspose::Words::PageExtractOptions>();
extractOptions->set_UpdatePageStartingNumber(false);
extractOptions->set_UnlinkPagesNumberFields(false);
System::SharedPtr<Aspose::Words::Document> extractedDoc2 = doc->ExtractPages(1, 1, extractOptions);
extractedDoc2->Save(get_ArtifactsDir() + u"Document.ExtractPagesWithOptions.Options.docx");
See Also
- Namespace Aspose::Words
- Library Aspose.Words for C++