954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to get MS word document page settings and number of pages using JavaScript?

Hello,

This is Gokul Rangarajan. I need a suggestion or code in JavaScript which reads the MS Word document page settings and number of pages. I know how to open and read a MS Word document, but i couldn't able to get page properties. Some one please help me with this.

Thank you,
Gokul Rangarajan

gokul.raja
Newbie Poster
8 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

Hi, this is gokul rangarajan. I just found solution for my proble,

var w=new ActiveXObject('Word.Application'); --creare MS word obj.
w.Documents.Open("C:\\ABSTRACT.doc"); -- open a doc..
obj=w.visible=false; --- set visible false
obj.Content; --- to get content in MS word doc..
w.ActiveDocument.ComputeStatistics(2); -- Get number of pages
w.ActiveDocument.ActiveWindow.Panes(1).Pages.Item(1).Width; -get width in pixels..
w.ActiveDocument.ActiveWindow.Panes(1).Pages.Item(1).Height; -get height in pixels..
w.ActiveDocument.PageSetup.TopMargin --get Margin top in pixels
w.ActiveDocument.PageSetup.LeftMargin --get Margin left in pixels
w.ActiveDocument.PageSetup.BottomMargin --get Margin bottom in pixels
w.ActiveDocument.PageSetup.RightMargin --get Margin right in pixels
w.ActiveDocument.PrintOut(); //Print given document


Note: 72 pixel = 1 inches.

Thank you,:cool:
Gokul Rangarajan

gokul.raja
Newbie Poster
8 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You