>Charles Vermette wrote:
>> Hi,
>>
>> I'm working on a project converting between a locally defined XML file
>> format and OpenOffice Writer format. We use an XSLT filter and the API call
>> storeToURL to store user edited information back to the server. We recently
>> changed the extension of the Writer file we use to a different extension
>> than ".SXW" to help us load different configurations for these generated
>> Writer files to restrict user options. The filter is registered in
>> OpenOffice through Tools->XML Filter Settings.
>
>Do I understand it correctly: you have a format of your own and you
>provide a registered import filter for this format that is able to
>import the format to the OOo writer format?


We have a format of our own, but we use Xalan on a remote server to transform it to the files and format needed by OpenOffice and zip them up to form an SXW file to be read by OpenOffice Writer. So, there's no import needed for Writer to be able to read our files. The change of extension is only used because we want different editing and toolbar configurations for files generated by our server as part of our editing process. The filter that we register is an export filter that transforms the OpenOffice representation back to our own format so we can upload it to the remote server. The way the system was written was for each side of the process, client and server, to transform to the other side's dialect of XML before talking.

>> Until the time we changed the extension, we did not have any problems with
>> this system. However, once we changed the extension to separate our
>> system's documents from normal OpenOffice documents, we began having
>> problems loading the files. If one of our system's files is loaded through
>> the Writer UI, it asks us to choose a filter for the file type. If the
>> files are loaded through an OpenOffice BASIC macro, the macro simply fails.
>> I gather from the documentation online that this is the expected result
>> when a macro tries to load or save a file who's filter is not known.
>> However, if we do not have any filter registered, a deep type detection
>> realizes that the generated document is a Writer document and loads it
>> properly. With the filter registered, it is not able to locate the filter
>> unless the file has the proper ".SXW" extension.
>
>Do you provide a deep detection component?
>Can you show us your typedetection configuration for your filter (both
>type and filter part)?
>Is the file loaded by your filter if you select it in the filter dialog?


We don't install any special deep type detection (since the files we open are just normal OpenOffice Writer files). There seems to be some deep type detection already registered in OpenOffice, because if we give the Writer files we generate a different extension (we use .cops, after the name of the project) instead of .sxw without any filters registered, it still loads the file without requiring user input. However, once we register an XSLT based export filter we need to have the files named correctly as .sxw or the user has to specify the filter to use when opening them.

If done through the UI, the user can select to open the file as an OpenOffice 1.0 Text Document and it opens correctly. However, the forced selection breaks macros we've written that automatically retrieve and load the next document to be edited. The document is pulled down from the server correctly, and so long as we don't have the export filter registered they will load, but with the export filter registered the loadFromURL call fails. These documents are also in OpenOffice format, and I can fix the problem in the macros by specifying the filter to use when loading as part of the macro. This is just partially covering up what seems to be a problem either in the OpenOffice is resolving the file type or in the way we've set up our export filter and I would rather fix the root of the problem. Also, that fix would still require the user to select the OpenOffice 1.0 Text Document manually on opening the first file, which is an annoyance for them.

Our filter setup is:

General:
Filter Name: gleimML
Application: OpenOffice.org Writer
Name of Filetype: xml_gleimml
File Extension: xml
Transformation:
XSLT for export: C:\Program Files\OpenOffice.org1.1.4\user\xslt\gleimML\oo-filter.xsl


And the BASIC fragment that uses the filter is:

Dim gleimSaveArgs(0) As Object
Set gleimSaveArgs(0) = MakePropertyValue("FilterName", "gleimML")           
ThisComponent.storeToURL(getGleimURL(currentQuestion),gleimSaveArgs())

MakePropertyValue is a function someone lifted from ooforums.org that just packages the given name/value pair as a PropertyValue bean.

Charles Vermette
[EMAIL PROTECTED]
Software Development


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to