.NET Word Page Layout-Set Word Column Display in C# and Visual Basic

Page Column Display is one kind of page layout setting. It separates page contents into two or three columns and users can set the column width and space between columns to have the satisfied layout. In this article, I will introduce an easy method to change the original Word layout as Word column layout in C# and Visual Basic.

In this example, I just separate contents of one document into two columns. At the beginning, I should prepare some materials: Word document and the .NET Word component, Spire.Doc for .NET to realize function to set Word column. Then, add the component dll as reference in my project.

Now, follow the steps. Firstly, initialize a Document instance and invoke Document.LoadFromFile method with overload string file name to load the prepared Word document. Secondly, initialize a new instance of Column class from the existing document. Invoke ColumnCollection.Add method to add columns for section of document. The overload passed to this method is this Column instance. If you want to set column width and space between current and next column, you need to set Width and Space property of Column class before invoking ColumnCollection.Add method. Thirdly, invoke Document.SaveToFile method with string filename and FileFormat overloads to save changed document and launch for viewing.


using Spire.Doc;

namespace WordColumns


    class Program


        static void Main(string[] args)


            //Load Document

            Document document = new Document();

            document.LoadFromFile(@”E:\Work\Documents\WordDocuments\Blues Introduction.docx”);


            //Add Columns

            Column col = new Column(document);



            //Save and Launch

            document.SaveToFile(“WordColumns.docx”, FileFormat.Docx);





Visual Basic

Imports Spire.Doc

Namespace WordColumns

    Friend Class Program

        Shared Sub Main(ByVal args() As String)

            ‘Load Document

            Dim document As New Document()

            document.LoadFromFile(“E:\Work\Documents\WordDocuments\Blues Introduction.docx”)


            ‘Add Columns

            Dim col As New Column(document)



            ‘Save and Launch

            document.SaveToFile(“WordColumns.docx”, FileFormat.Docx)


        End Sub

    End Class

End Namespace

After debugging, we can get the following result:

Download Spire.Doc for .NET Here

P.S. The .NET Office component, Spire.Office for .NET can be used to realize this function as well.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s