Class WordML2003SaveOptions
Namespace: Aspose.Words.Saving
Assembly: Aspose.Words.dll (25.12.0)
Can be used to specify additional options when saving a document into the Aspose.Words.SaveFormat.WordML format.
To learn more, visit the Specify Save Options documentation article.
public class WordML2003SaveOptions : SaveOptionsInheritance
object ← SaveOptions ← WordML2003SaveOptions
Inherited Members
SaveOptions.CreateSaveOptions(SaveFormat) , SaveOptions.CreateSaveOptions(string) , SaveOptions.SaveFormat , SaveOptions.ExportGeneratorName , SaveOptions.TempFolder , SaveOptions.PrettyFormat , SaveOptions.UseAntiAliasing , SaveOptions.UseHighQualityRendering , SaveOptions.DmlRenderingMode , SaveOptions.DmlEffectsRenderingMode , SaveOptions.ImlRenderingMode , SaveOptions.DefaultTemplate , SaveOptions.UpdateFields , SaveOptions.UpdateLastSavedTimeProperty , SaveOptions.UpdateLastPrintedProperty , SaveOptions.UpdateCreatedTimeProperty , SaveOptions.MemoryOptimization , SaveOptions.UpdateAmbiguousTextFont , SaveOptions.Dml3DEffectsRenderingMode , SaveOptions.ProgressCallback , SaveOptions.AllowEmbeddingPostScriptFonts , SaveOptions.CustomTimeZoneInfo , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Shows how to manage memory optimization.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello world!");
// Create a "WordML2003SaveOptions" object to pass to the document's "Save" method
// to modify how we save the document to the WordML save format.
WordML2003SaveOptions options = new WordML2003SaveOptions();
// Set the "MemoryOptimization" flag to "true" to decrease memory consumption
// during the document's saving operation at the cost of a longer saving time.
// Set the "MemoryOptimization" flag to "false" to save the document normally.
options.MemoryOptimization = memoryOptimization;
doc.Save(ArtifactsDir + "WordML2003SaveOptions.MemoryOptimization.xml", options);Shows how to manage output document’s raw content.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello world!");
// Create a "WordML2003SaveOptions" object to pass to the document's "Save" method
// to modify how we save the document to the WordML save format.
WordML2003SaveOptions options = new WordML2003SaveOptions();
Assert.That(options.SaveFormat, Is.EqualTo(SaveFormat.WordML));
// Set the "PrettyFormat" property to "true" to apply tab character indentation and
// newlines to make the output document's raw content easier to read.
// Set the "PrettyFormat" property to "false" to save the document's raw content in one continuous body of the text.
options.PrettyFormat = prettyFormat;
doc.Save(ArtifactsDir + "WordML2003SaveOptions.PrettyFormat.xml", options);
string fileContents = File.ReadAllText(ArtifactsDir + "WordML2003SaveOptions.PrettyFormat.xml");
string newLine = Environment.NewLine;
if (prettyFormat)
Assert.That(fileContents.Contains(
$"<o:DocumentProperties>{newLine}\t\t" +
$"<o:Revision>1</o:Revision>{newLine}\t\t" +
$"<o:TotalTime>0</o:TotalTime>{newLine}\t\t" +
$"<o:Pages>1</o:Pages>{newLine}\t\t" +
$"<o:Words>0</o:Words>{newLine}\t\t" +
$"<o:Characters>0</o:Characters>{newLine}\t\t" +
$"<o:Lines>1</o:Lines>{newLine}\t\t" +
$"<o:Paragraphs>1</o:Paragraphs>{newLine}\t\t" +
$"<o:CharactersWithSpaces>0</o:CharactersWithSpaces>{newLine}\t\t" +
$"<o:Version>11.5606</o:Version>{newLine}\t" +
"</o:DocumentProperties>"), Is.True);
else
Assert.That(fileContents.Contains(
"<o:DocumentProperties><o:Revision>1</o:Revision><o:TotalTime>0</o:TotalTime><o:Pages>1</o:Pages>" +
"<o:Words>0</o:Words><o:Characters>0</o:Characters><o:Lines>1</o:Lines><o:Paragraphs>1</o:Paragraphs>" +
"<o:CharactersWithSpaces>0</o:CharactersWithSpaces><o:Version>11.5606</o:Version></o:DocumentProperties>"), Is.True);Remarks
At the moment provides only the Aspose.Words.Saving.WordML2003SaveOptions.SaveFormat property, but in the future may have other options added.
Constructors
WordML2003SaveOptions()
public WordML2003SaveOptions()Properties
SaveFormat
Specifies the format in which the document will be saved if this save options object is used. Can only be Aspose.Words.SaveFormat.WordML.
public override SaveFormat SaveFormat { get; set; }Property Value
Examples
Shows how to manage output document’s raw content.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello world!");
// Create a "WordML2003SaveOptions" object to pass to the document's "Save" method
// to modify how we save the document to the WordML save format.
WordML2003SaveOptions options = new WordML2003SaveOptions();
Assert.That(options.SaveFormat, Is.EqualTo(SaveFormat.WordML));
// Set the "PrettyFormat" property to "true" to apply tab character indentation and
// newlines to make the output document's raw content easier to read.
// Set the "PrettyFormat" property to "false" to save the document's raw content in one continuous body of the text.
options.PrettyFormat = prettyFormat;
doc.Save(ArtifactsDir + "WordML2003SaveOptions.PrettyFormat.xml", options);
string fileContents = File.ReadAllText(ArtifactsDir + "WordML2003SaveOptions.PrettyFormat.xml");
string newLine = Environment.NewLine;
if (prettyFormat)
Assert.That(fileContents.Contains(
$"<o:DocumentProperties>{newLine}\t\t" +
$"<o:Revision>1</o:Revision>{newLine}\t\t" +
$"<o:TotalTime>0</o:TotalTime>{newLine}\t\t" +
$"<o:Pages>1</o:Pages>{newLine}\t\t" +
$"<o:Words>0</o:Words>{newLine}\t\t" +
$"<o:Characters>0</o:Characters>{newLine}\t\t" +
$"<o:Lines>1</o:Lines>{newLine}\t\t" +
$"<o:Paragraphs>1</o:Paragraphs>{newLine}\t\t" +
$"<o:CharactersWithSpaces>0</o:CharactersWithSpaces>{newLine}\t\t" +
$"<o:Version>11.5606</o:Version>{newLine}\t" +
"</o:DocumentProperties>"), Is.True);
else
Assert.That(fileContents.Contains(
"<o:DocumentProperties><o:Revision>1</o:Revision><o:TotalTime>0</o:TotalTime><o:Pages>1</o:Pages>" +
"<o:Words>0</o:Words><o:Characters>0</o:Characters><o:Lines>1</o:Lines><o:Paragraphs>1</o:Paragraphs>" +
"<o:CharactersWithSpaces>0</o:CharactersWithSpaces><o:Version>11.5606</o:Version></o:DocumentProperties>"), Is.True);