Sibeesh Passion

Using Spire.Doc Introduction



Hi I hope you all are fine. Today we are going to see a new product which helps us to create Office documents in an easy manner. Have you ever worked with any office documents? If yes I am sure you would face so many problems and complex operations for loading and showing that loaded file and converting between them like word to pdf, pdf to word, word to html etc. We developers may need to spend much amount of time for this operations, Now I am going to introduce a new product which helps you doing this operation.


Few days back my manager asked me to integrate a part to my project in which we need to load the excel file, show that file, provision to convert the same to another format. As you all know these operations are not easy as it sounds cool. I started developing the same. While browsing I came to know about this product (e-iceblue). Trust me this product is simply awesome and it does the work it has to.

What we are going to discuss?

Once you download the needed file from spire-office-for-net you are ready to go. Please install the application in your system. If you want you can add the controls to your visual studio tool box at the time of installation. Or you can manually load those. We are going to discuss basics of the Spire Doc for dot net. I hope you will enjoy reading.

So Shall we start that?

We will start with a “Hello World” program. Before getting started, Please install Spire.Doc and Visual studio 2008 or above. I am using Visual Studio 2015 RC. I hope everything set 🙂

Open your Visual Studio, click on New->Project->Select Visual C# (if you are good in C# or select Visual Basic) Project->Windows->Windows forms application->Name your project(I am naming it as IntroSpireDoc)

Right click on your project and click add reference, in the browse tab find out the folder in which you have installed spire doc. Usually it will be in the C:\Program Files\e-iceblue\Spire.Doc. Now just find your framework version from BIN folder and add Spire.Doc.dll

Cool!. Now you are ready to go.

Create a button in the form, and in the button click event we will start our coding part 🙂 deal?

Before that please do not forget to load the references.

using Spire.Doc;
using Spire.Doc.Documents;

Now please add the following code to the button click event.

            //Create word document  
            Document document = new Document();
            //Create word document 
            Paragraph paragraph = document.AddSection().AddParagraph();
            //Append Text
            paragraph.AppendText("Hello World!");
            //Save doc file.
            document.SaveToFile("Sample.doc", FileFormat.Doc);
            //Launching the MS Word file.
            catch { }

As you see the above codes, it is so simple right? We have done the following processes by the above mentioned few

  • Create word document
  • Create word document
  • Append Text
  • Save doc file.
  • Launching the MS Word file.
  • So we have done it. Now we will RUN our program and see the output. Are you ready?



    I hope you liked this article. Please share me your valuable suggestions and feedback.

    Kindest Regards
    Sibeesh Venu

    Footer With Address And Phones