Issue 3408 - can't change Textfields in Header/Footer of a spreadsheet
Summary: can't change Textfields in Header/Footer of a spreadsheet
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows 95
: P3 Trivial
Target Milestone: ---
Assignee: oc
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-08 14:56 UTC by Oliver Brinzing
Modified: 2013-02-24 21:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Oliver Brinzing 2002-03-08 14:56:21 UTC
When I read the content of the header in a sheet, I get as String with "???" for
the Textfields, getPresentation does not work.

When I set the Textfield "FileName" I can't find properties to change the content
from e.g. "file:///e:/user/work/.example.sdc" to "example.sdc"
Comment 1 frank 2002-03-08 15:55:57 UTC
Hi Oliver,

Point 1:

Don't know what you mean. Could you be so kind and describe your
problem a litte more precise ?
What do you mean by 'getPresentation does not work'?

Point 2:

If you select Edit - Header / Footer from the meu bar, select the
field with the path and filename and press the button for a longer
time. Now select just filename and you should get only the filename
instead of the full path.
Comment 2 frank 2002-03-08 15:59:33 UTC
Ooops, I have to be a little more precise too.

So it goes :

If you select Edit - Header / Footer from the meu bar, select the
field with the path and filename

move the mouse pointer over Button with the folder...

and press the button for a longer time. Now select just filename and
you should get only the filename instead of the full path.

Best regards
Frank
Comment 3 Oliver Brinzing 2002-03-08 21:56:49 UTC
hope this will help you

'You can use the XTextFieldsSupplier interface of the header text.
' But I tried to use getPresentation and it turned out that it's not 
' possible to get the presentation that way from a calc header 
' filename field (neither the field command nor the presented 
' content). It is always „???“, so it seems not to be implemented yet.

dim pagestylename as string
Dim oPageStyle as Object
Dim oLeftContentText as object
dim oFields as object
dim oField as object
dim oFieldEnum as Object

oSheet = thiscomponent.getSheets.getByIndex(0)
pageStyleName = oSheet.PageStyle
oPageStyle = 
thiscomponent.getStyleFamilies.getByName("PageStyles").getByName(pageS
tyleName)
'right page header is the master for right and left pages
oLeftContentText = oPageStyle.RightPageHeaderContent.getLeftText
oFields = oleftContentText.getTextFields
oFieldEnum = oFields.createEnumeration
while oFieldEnum.hasMoreElements
        oField = oFieldEnum.nextElement()
        MsgBox oField.dbg_methods
        print oField.getPresentation(true), 
oField.getPresentation(False)
wend

'Could you please file a bug in the sc project on Issuezilla for the 
'getPresentation problem and an enhancement request to add the 
'property 
'FileFormat to FileName fields in Calc?
'Dietrich
Comment 4 frank 2002-03-11 08:20:29 UTC
Hi Oliver,

not really. But this is because your Issue seems to be a problem with
the API and not really the spreadsheet. So I changed the component.

Best regards

Frank
Comment 5 ooo 2002-03-11 10:34:43 UTC
It is an API issue, but not an API definition issue. Thus somebody of
the calc team has to take care for this bug.
Comment 6 niklas.nebel 2002-03-12 15:35:31 UTC
For fields like PageNumber or SheetName, getPresentation can't return
a meaningful value because the header is a property of the page style,
not a single page or sheet. But for DocumentTitle and FileName I think
it can be changed to return the right value.

The FileName field's FileFormat property can be set when inserting a
new field. For an existing field this doesn't work because of an error
in the ScHeaderFieldsObj implementation.
Comment 7 Oliver Brinzing 2002-03-14 15:42:07 UTC
Hi,

> The FileName field's FileFormat property can be set when inserting
> a new field. 
But how can I do this ?
I am using

 oField =  
oDocument.createInstance("com.sun.star.text.TextField.FileName") 
oText.insertTextContent(oCursor, oField, False)

to insert the Textfields ...

> For an existing field this doesn't work because of an 
> error in the ScHeaderFieldsObj implementation.

regards
Oliver
Comment 8 niklas.nebel 2002-04-19 15:13:00 UTC
Just add a line like
oField.FileFormat = com.sun.star.text.FilenameDisplayFormat.FULL
before the insertTextContent call.

If you have further questions, please ask on the mailing list, as
adding a comment to an issue resets its state to "new".
Comment 9 niklas.nebel 2002-12-19 16:08:55 UTC
Changing the format of an inserted field is fixed with
sc/source/ui/unoobj/fielduno.cxx 1.10.8.1 in the calc-01 child
workspace, which will be in a future 644 developer build.
The getPresentation values won't be changed because a
HeaderFooterContent object isn't even tied to a specific document,
it's just a container for the text content.
Comment 10 niklas.nebel 2003-01-07 18:42:29 UTC
Reopening to reassign
Comment 11 niklas.nebel 2003-01-07 18:42:46 UTC
Reassigning to QA for verification
Comment 12 niklas.nebel 2003-01-07 18:43:00 UTC
Restoring "fixed" state
Comment 13 stephan.wunderlich 2003-01-09 13:57:41 UTC
Field 'FileName' can be changed after insertion in workspace 'calc1'
=> verified.

Used macro:
oDoc = ThisComponent
oSheet = oDoc.Sheets(0)
oFamilies = oDoc.StyleFamilies
oFamily = oFamilies.getByName("PageStyles")
oStyle = oFamily.getByName( oSheet.PageStyle )

oObj = oStyle.RightPageHeaderContent
oText = oObj.LeftText

oFields = oText.TextFields
oField = oFields(0)

print oField.FileFormat
oField.FileFormat = 0
print oField.FileFormat

oStyle.RightPageHeaderContent = oObj
Comment 14 michael.bemmer 2003-03-13 11:13:28 UTC
As mentioned on the qa dev list on March 5th I will close all resolved
<wontfix/duplicate/worksforme/invalid> issues. Please see this posting for details.