NodeToString(SaveOptions) Method |
Exports the content of the node into a string using the specified save options.
Namespace:
Aspose.Words
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 21.2.0
Syntax
public string ToString(
SaveOptions saveOptions
)
Public Function ToString (
saveOptions As SaveOptions
) As String
public:
String^ ToString(
SaveOptions^ saveOptions
)
member ToString :
saveOptions : SaveOptions -> string
Parameters
- saveOptions
- Type: Aspose.Words.SavingSaveOptions
Specifies the options that control how the node is saved.
Return Value
Type:
StringThe content of the node in the specified format.
Examples
Exports the content of a node to String in HTML format.
Document doc = new Document(MyDir + "Document.docx");
Node node = doc.LastSection.Body.LastParagraph;
Assert.AreEqual("<p style=\"margin-top:0pt; margin-bottom:8pt; line-height:108%; font-size:12pt\">" +
"<span style=\"font-family:'Times New Roman'\">Hello World!</span>" +
"</p>", node.ToString(SaveFormat.Html));
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.ExportRelativeFontSize = true;
Assert.AreEqual("<p style=\"margin-top:0pt; margin-bottom:8pt; line-height:108%\">" +
"<span style=\"font-family:'Times New Roman'\">Hello World!</span>" +
"</p>", node.ToString(saveOptions));
See Also