Hello,
I would like to know what’s the differences between generating Word document with the Open XML SDK and generation Word with Aspose ?!
What are benefits of the Aspose method ?
In my case, Word DOCX format is only the wanted format and the only functionnality that currently makes me choose Aspose is the pdf conversion.
Thanks
Aspose.Words and Open XML SDK have the similar DOM. However, in Aspose.Words you can use DocumentBuilder that simplifies creating documents from scratch. For instance here is a simple code to generate “Hello word” document using XML SDK and Aspose.Words:
[XML SDK]
public void HelloWorld(string docName)
{
// Create a Wordprocessing document.
using(WordprocessingDocument package = WordprocessingDocument.Create(docName, WordprocessingDocumentType.Document))
{
// Add a new main document part.
package.AddMainDocumentPart();
// Create the Document DOM.
package.MainDocumentPart.Document = new Document(new Body(new Paragraph(new Run(new Text("Hello World!")))));
// Save changes to the main document part.
package.MainDocumentPart.Document.Save();
}
}
[Aspose.Words]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Hello World!!!");
doc.Save(@"out.docx");
Aspose.Words supports a wide set of documents formats: https://docs.aspose.com/words/net/supported-document-formats/
So, if it will be required to export or import your documents in other format than DOCX, you will be able to easily achieve this using Aspose.Words. No changes in the document generation process will be required.
Unlike, XML SDK, using Aspose.Words you can render your document into various formats, like PDF, XPS, SWF or image. In addition, you can print documents or convert them to series of Images. https://docs.aspose.com/words/net/rendering/
Well, you’ve answered your question yourself - rendering to PDF.
Then Adam added a few more useful facts.
From the top of my head I can add the following:
Document assembly. You can join documents or copy fragments from one document to another and Aspose.Words will do all the work of merging styles and list formatting properly.
Search and replace. Try searching for richly formatted text in the SDK, for example "HelloWorld". It will not find because “hello” and “world” will be in different nodes in XML, whereas Aspose.Words makes it easy.
Field Update! How could I forget. Assemble documents programmatically and insert a TOC field and update it exactly like MS Word does. That’s a job for Aspose.Words.
Range-like operations e.g. Bookmarks[“BMK1”].Text = “new text”. Try that in SDK and let us know how easy is that.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.