Working with paragraphs in Word documents – Word API for .NET

Elerium Word .NET component, new release 2.0 has been introduced by Elerium Software.
 
July 3, 2013 - PRLog -- MS Word documents are one of the most popular formats for the reporting. It allows presenting information with different styles and formatting exactly such as it should look on a paper. The basic structural elements of any document are text chunks, paragraph and table. The presentable of the final document depends on the correct formatting of these structures. Making the document does not take a lot of time, if MS Word is installed on the machine. However, the .NET developers do not always have that opportunity, especially when it is needed to automate the processing of multiple files. In this case, typically use a third-party API for working with documents MS Word.

A perfect solution is the latest version of Elerium Word .NET component by Elerium Software with some important changes:
- Html reader was completed
- Added Convert Options
- Changed Logical model of read/write methods
- DOC, DOCX formats: now footnotes/endnotes work
- Write methods of DOC, DOCX: now complex  footnotes/endnotes work
- Changed subdocument system

Elerium Word .NET component provides the ability to work with paragraphs simple and intuitive. First of all developer must install the component into the project:
1. Add Elerium Word .Net component to the solution. Simply put Word.dll into /bin folder of the project.
2. Initialize the Docs.Word instance.

When the component is connected to the project a developer can open existing Word document (or create new one) and work with its contents. For example, let’s take a simple document with four paragraphs and change its style:

C# code:

using System;
using System.Drawing;
using Docs.Word;

namespace Sample
{
   class Paragraphs_Style
   {
       internal static Document Main1()
       {
         //    Open the document with given name and gets all paragraphs
         Document Doc = Document.ReadDoc(@"c:\temp\test.doc");
         ParagraphList ParList = Doc.Sections[0].GetParagraphs();

         //    Change style properties of 1st paragraph
         ParList[0].Style.Alignment = Alignment.Left;
         ParList[0].Style.Indents.FirstLine = 30;
         ParList[0].Style.Shading = new Shading(Color.OrangeRed);

         //    Change style properties of 2nd paragraph
         ParList[1].Style.Alignment = Alignment.Justified;
         ParList[1].Style.Borders = new Borders(1, BorderStyle.Double, Color.DarkCyan, 10);

         //    Change style properties of 3rd paragraph
         ParList[2].Style.Alignment = Alignment.Center;
         ParList[2].Style.Spacings.LineSpacing.Spacing = 20;
         ParList[2].Style.Indents.Left = 50;
         ParList[2].Style.Shading = new Shading(Color.Yellow, Color.GreenYellow, ShadingStyle.VerticalStripe);
         ParList[2].Style.Spacings.SpacingAfter = 40;

         //    Change style properties of 4th paragraph
         ParList[3].Style.Alignment = Alignment.Right;
         ParList[3].Style.Spacings.LineSpacing.Type = LineSpacingType.Multiplier;
         ParList[3].Style.Spacings.LineSpacing.Spacing = 2;

//   Save result document
Doc.WriteDOC(@"c:\temp\test.doc");
       }
   }
}

After performing the transformation, with just a few lines of code, the document get the new formatting and became look more interesting. This is only a small part of the features that provided by Elerium Word .NET component.

About Elerium Software

Elerium Software develops professional solutions for use in .NET projects (C#, VB.NET, ASP.NET) that aimed to read/write/convert different office/web documents and formats. Elerium Software components are based on the unique design and fast algorithms that allow being independent from the third-party applications and libraries.

For more information about the component please visit the product page:
http://eleriumsoft.com/Word_NET/WordNet/Default.aspx
End
Source: » Follow
Email:***@eleriumsoft.com Email Verified
Tags:Create Word, Net, c, Asp Net, Vb Net
Industry:Computers, Software
Location:luzern - Switzerland
Account Email Address Verified     Account Phone Number Verified     Disclaimer     Report Abuse
Elerium Software PRs
Trending News
Most Viewed
Top Daily News



Like PRLog?
9K2K1K
Click to Share