Working with Word Documents (Create,Extract,Modify,etc.) without MS Office Installed
There are many libraries available in Java, dot net and other languages for creating and manipulating word documents. I recently came ac...

There are many libraries available in Java, dot net and other languages for creating and manipulating word documents. I recently came across one such dotnet library called "Bytescout document SDK" which I found to be highly useful, flawless and very simple too. It is freely available, also it does not require Microsoft Office to be installed on your machine. So let me quickly explain on how to use this SDK with a simple example. Though it is well documented I hope this explanation would help you to get started instantly once you download this SDK.
Bytescout Document SDK
using Bytescout.Document;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
using (Document doc = new Document(DocumentFormat.OpenXml))
{
Paragraph p = doc.AddParagraph();
p.Text = "Hello, world!";
p = doc.AddParagraph();
p.Text = "Please evaluate Bytescout Document SDK.";
p.Text += " It may save you some time and effort when creating documents.";
doc.Save("output.docx");
System.Diagnostics.Process.Start("output.docx");
}
}
}
}
Imports Bytescout.Document
Module Module1
Sub Main()
Using doc As New Document(DocumentFormat.OpenXml)
Dim p As Paragraph = doc.AddParagraph()
p.Text = "Hello, world!"
p = doc.AddParagraph()
p.Text = "Please evaluate Bytescout Document SDK."
p.Text += " It may save you some time and effort when creating documents."
doc.Save("output.docx")
System.Diagnostics.Process.Start("output.docx")
End Using
End Sub
End Module
Benefits
- Microsoft Word (or Microsoft Office) is not required;
- Made with 100% managed code for .NET. Both .NET 1.10 (Visual Studio 2003) and 2.00 (Visual Studio 2005,2008 or higher) frameworks are supported;
- Operations with documents, paragraphs and text runs are supported;
- Unicode text support;
- Paragraph and text run formating (font, color, highlighting, alignment and other parameters) is supported;
- Text extraction is supported;
- You can search for text in documents using built-in search functionality;
- You can replace text in documents using built-in search and replace functionality;
- Reading of document is supported: you can open existing DOC or DOCX file and extract text from it. You can also open DOCX file and modify text or formatting (change text, add or remove paragraphs etc.) then save document as new DOCX file;
- And much more!
I use Aspose.Words for .NET Library for managing my word files and i have used many of their sample codes in my Api and so far i am very much satisfied with its working. You should try this library also.
ReplyDeleteYes. But it is not opensource and we need to pay to get licensed version of it. Otherwise, Aspose is really good according to what I hear from many.
DeleteHey! Use our past tense of proofread tool. Our assistant was created to check and correct errors in your text related to the use of the verb tense. You no longer need to waste your time on this. Our assistant is absolutely free and works very quickly. Just try it!
ReplyDelete