Page 1 of 1

[Solved] How to get the Page Number of Text Fields

Posted: Wed May 07, 2014 7:24 am
by id_james2000
Hi friends,

I want to get the Page Number of the DependentTextFields.

I haven given below my code.


oFieldMaster = ThisComponent.TextFieldMasters
oField = oFieldMaster.getByName("com.sun.star.text.fieldmaster.SetExpression.Left_Guideword_L")
stDTF = oField.DependentTextFields


stDFT has array of Text fields. I want to get the Page Number of each field.

Thank you.

James

Re: How to get the Page Number of Text Fields

Posted: Wed May 07, 2014 1:07 pm
by FJCC
The only way I know of to get a page location is with the ViewCursor. I would use code like this

Code: Select all

oVC = ThisComponent.CurrentController.ViewCursor
oTextFields = ThisComponent.TextFields
FieldEnum = oTextFields.createEnumeration()
While FieldEnum.hasMoreElements
	oField = FieldEnum.nextElement()
	Anch = oField.Anchor
	oVC.gotoRange(Anch.Start, False)
	Print oVC.Page
Wend

Re: How to get the Page Number of Text Fields

Posted: Fri May 09, 2014 9:28 am
by id_james2000
Dear FJCC,

Thank you so much. Your code solved my problem.

Great Help. :D

James