Highlighting Borders of Header using Java API

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ravi2082
Posts: 1
Joined: Sun Jan 06, 2008 11:04 am

Highlighting Borders of Header using Java API

Post by ravi2082 »

Hi,

I am using the following code to make the header top border visible in a document. I get the header content correctly but the lines are not visible. Please help.

Code: Select all

XNameAccess PageStyles = (XNameAccess) AnyConverter.toObject (new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
StdStyle = (XStyle) AnyConverter.toObject(new Type(XStyle.class),PageStyles.getByName("Standard"));
XPropertySet PropSet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
PropSet.setPropertyValue("HeaderIsOn", new Boolean(true));
     BorderLine bl = (BorderLine)UnoRuntime.queryInterface(BorderLine.class,PropSet.getPropertyValue("HeaderTopBorder"));
     bl.Color=30;
     bl.InnerLineWidth=(short)2;
     bl.OuterLineWidth=(short)2;
//set the borderline object back to the property
     PropSet.setPropertyValue("HeaderTopBorder", bl);
Next I set the header text which is showing up in my doc file but border is not visible. I am generating a word and pdf file at the same time.Using the above code I see that the border is getting highlighted in PDF file but not in the Word file. Please advise.

Thanks
Ravi
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: Highlighting Borders of Header using Java API

Post by hol.sten »

ravi2082 wrote:I am generating a word and pdf file at the same time. Using the above code I see that the border is getting highlighted in PDF file but not in the Word file. Please advise.
Sorry, but all I have are a lot of questions:
- Do you generate your pdf file or your doc file first? Does anything change if you change the order?
- What happens to your border, if you save your document as an odt or rtf file?
- What happens to your border, if you do not change the "Standard" style but create your own style and assign that to the header?
- How do you open the doc file? With OpenOffice.org, Word (which version?), or with the Word Viewer? Or did you already try all of them?
- BTW: Which OOo version, which operating system and which Java version are you using?

Regards
hol.sten
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
pitonyak
Volunteer
Posts: 186
Joined: Sun Oct 07, 2007 9:13 pm
Location: Columbus, Ohio, USA

Re: Highlighting Borders of Header using Java API

Post by pitonyak »

I will repeat what I think that you said...


You have an OpenOffice.org document.
You modify the document using Java.
You export the document as a PDF, which shows the changes.
You export the document as a DOC file, which does not show the changes.

Do you see the changes in OOo?

If the changes export to the PDF, then I would say that they are made and working and the problem is probably the export to the DOC file.

I also assume that you manually export rather than using a macro...
Andrew Pitonyak
http://www.pitonyak.org/oo.php
LO and AOO on Fedora
Post Reply