How to identify the single column and double column from the word document


#1

Hi Team,

My requirement is how to identify the document which is single or double column document from the input word document.

Identify the type of column and print the type.please kindly help me to identify the same.

Input Sample 1(Single): Figures (2).zip (2.1 MB)

Input Sample 2(Double): renamed_c016d.zip (505.4 KB)

Regards,
Priyanga G


#2

@priyanga,

Thanks for your inquiry. Please use PageSetup.TextColumns property to get a collection that represents the set of text columns. You can use TextColumnCollection.Count property to get the number of columns in the section of a document. Please check the following code example.

Document document = new Document(MyDir + "renamed_c016d.docx");
System.out.println(document.getSections().get(1).getPageSetup().getTextColumns().getCount());

#3

Hi @tahir.manzoor,

Thank you very much.

I am able get the exact output.

Thanks & regards,
priyanga G