OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to add Header/Footer in Spreadsheet?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
rospcc
General User
General User


Joined: 25 Apr 2005
Posts: 32

PostPosted: Tue Jul 05, 2005 2:04 am    Post subject: How to add Header/Footer in Spreadsheet? Reply with quote

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
View user's profile Send private message
atd
General User
General User


Joined: 02 Jul 2005
Posts: 30

PostPosted: Tue Jul 05, 2005 2:22 am    Post subject: Reply with quote

File->Page->Header(Or Footer)->Edit

Is this what you want?
Back to top
View user's profile Send private message Visit poster's website
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Tue Jul 05, 2005 6:38 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
rospcc
General User
General User


Joined: 25 Apr 2005
Posts: 32

PostPosted: Tue Jul 05, 2005 7:56 pm    Post subject: Reply with quote

Hi,

I've downloaded the file, but it is in .sxc file not the java codes?

Cheers,
rospcc
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Tue Jul 05, 2005 10:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
rospcc
General User
General User


Joined: 25 Apr 2005
Posts: 32

PostPosted: Mon Aug 15, 2005 1:51 am    Post subject: Insert Header/Footer Reply with quote

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
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Mon Aug 15, 2005 11:37 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
rospcc
General User
General User


Joined: 25 Apr 2005
Posts: 32

PostPosted: Tue Aug 16, 2005 1:48 am    Post subject: Header/Footer Reply with quote

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
View user's profile Send private message
rospcc
General User
General User


Joined: 25 Apr 2005
Posts: 32

PostPosted: Tue Aug 16, 2005 2:00 am    Post subject: Header/Footer Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group