| View previous topic :: View next topic |
| Author |
Message |
rospcc General User

Joined: 25 Apr 2005 Posts: 32
|
Posted: Tue Jul 05, 2005 2:04 am Post subject: How to add Header/Footer in Spreadsheet? |
|
|
Hi,
Another problem, how can I add Header/Footer in Spreadsheet? I looked at the PageStyle, TablePageStyle, XHeaderFooterContent, but I did not sure which one do I have to use?
Thanks,
rospcc |
|
| Back to top |
|
 |
atd General User


Joined: 02 Jul 2005 Posts: 30
|
Posted: Tue Jul 05, 2005 2:22 am Post subject: |
|
|
File->Page->Header(Or Footer)->Edit
Is this what you want? |
|
| Back to top |
|
 |
probe1 Moderator


Joined: 18 Aug 2004 Posts: 2465 Location: Chonburi Thailand Asia
|
Posted: Tue Jul 05, 2005 6:38 am Post subject: |
|
|
I think (by mentioning XHeaderFooterContent) the OP wants to manipulate Calc headers and footers by automation....
So: have a look at this example (in OOo Basic):
http://www.ooomacros.org/user.php#128903
HTH _________________ Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs |
|
| Back to top |
|
 |
rospcc General User

Joined: 25 Apr 2005 Posts: 32
|
Posted: Tue Jul 05, 2005 7:56 pm Post subject: |
|
|
Hi,
I've downloaded the file, but it is in .sxc file not the java codes?
Cheers,
rospcc |
|
| Back to top |
|
 |
probe1 Moderator


Joined: 18 Aug 2004 Posts: 2465 Location: Chonburi Thailand Asia
|
Posted: Tue Jul 05, 2005 10:23 pm Post subject: |
|
|
Just as I wrote:
it's a OOo Basic example in the attached macros.... _________________ Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs |
|
| Back to top |
|
 |
rospcc General User

Joined: 25 Apr 2005 Posts: 32
|
Posted: Mon Aug 15, 2005 1:51 am Post subject: Insert Header/Footer |
|
|
Sorry I don't understand the macro at all, it didn't show anything such as which interface/methods should I use.
Anybody knows which Interface to set the header/footer? |
|
| Back to top |
|
 |
probe1 Moderator


Joined: 18 Aug 2004 Posts: 2465 Location: Chonburi Thailand Asia
|
Posted: Mon Aug 15, 2005 11:37 am Post subject: |
|
|
Headers/Footers in Calc are set by applying a page style with H/F turned on to the sheet in question..
Page styles can be accessed from the style families of the document.
/sdk1.1.0/docs/DevelopersGuide/Spreadsheet/Spreadsheet.htm#1+4+1+2+Page+Styles _________________ Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs |
|
| Back to top |
|
 |
rospcc General User

Joined: 25 Apr 2005 Posts: 32
|
Posted: Tue Aug 16, 2005 1:48 am Post subject: Header/Footer |
|
|
Hi,
Would you be able to give me an example with the codes? I have been looking into the PageStyle properties and other services under it, but I just couldn't get it working.
Regards,
rospcc |
|
| Back to top |
|
 |
rospcc General User

Joined: 25 Apr 2005 Posts: 32
|
Posted: Tue Aug 16, 2005 2:00 am Post subject: Header/Footer |
|
|
This is the code that I implemented, it managed to set the header to be ON/OFF, but I still couldn't find the way to insert string to the header/footer
xRemoteServiceManager = OO.getRemoteServiceManager("uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager");
xDoc = OO.openDoc(xRemoteServiceManager, templateURL);
XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class, xDoc);
com.sun.star.style.XStyleFamiliesSupplier xSFS = (com.sun.star.style.XStyleFamiliesSupplier)
UnoRuntime.queryInterface(com.sun.star.style.XStyleFamiliesSupplier.class, xModel);
com.sun.star.container.XNameAccess xFamilies = xSFS.getStyleFamilies();
String[] Families = xFamilies.getElementNames();
Object aFamilyObj = xFamilies.getByName(Families[1]); //page style
com.sun.star.container.XNameAccess xStyles = (com.sun.star.container.XNameAccess) UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class, aFamilyObj);
String[] Styles = xStyles.getElementNames();
Object aStyleObj = xStyles.getByName(Styles[2]); //sheet1
com.sun.star.style.XStyle xStyle = (com.sun.star.style.XStyle)
UnoRuntime.queryInterface(com.sun.star.style.XStyle.class, aStyleObj);
com.sun.star.beans.XPropertySet xPropSet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xStyle);
xPropSet.setPropertyValue("HeaderIsOn", new Boolean(false));
Regards,
rospcc |
|
| Back to top |
|
 |
|