Highlighting Borders of Header using Java API

Creating a macro - Writing a Script - Using the API

Highlighting Borders of Header using Java API

Postby ravi2082 » Sun Jan 06, 2008 11:11 am

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   Expand viewCollapse view
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
ravi2082
 
Posts: 1
Joined: Sun Jan 06, 2008 11:04 am

Re: Highlighting Borders of Header using Java API

Postby hol.sten » Sun Jan 13, 2008 1:56 am

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
hol.sten
Volunteer
 
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: Highlighting Borders of Header using Java API

Postby pitonyak » Sun Jan 13, 2008 4:37 pm

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
pitonyak
Volunteer
 
Posts: 186
Joined: Sun Oct 07, 2007 9:13 pm
Location: Columbus, Ohio, USA


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests