Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hello,

Let me reply to this a bit more in length.

On 27/03/12 02:45, huqitu du wrote:
I don't need detect the file format, I only need to know the file
extension name and if it is .wps(for example abc.wps) when open file
then lets my DLL function( the function can translate the wps file into
LO file format) handle it, and the function will make a new file named
.odt( for example abc.odt) and let's LO reopen the abc.odt file, that's all.

I assume that by WPS you mean Microsoft Works Wordprocessing
file-format. For that one, LibreOffice has an import filter. If it is
not the case, please specify what WPS means for you and we can
investigate more.

Since there is already a file-format that uses *.wps extension and that
is handled by LibreOffice, detecting other unrelated file-format using
the same extension cannot be made using the flat detection, aka
extension only. You will have to first write a proper detection that
will peek the file and unambiguously decide that it is a file your
filter can handle.

In general, having a filter that first converts a document into a
temporary file and then loads the temporary file is not the best idea
and it is indicated to avoid this as much as you can. We have one or two
filters that work like this but it is purely because of licensing issues
that they cannot be used in-process.

Nevertheless, since your DLL as you say can produce a whole file in
OpenDocument format, it should be reasonably easy to produce SAX
messages in flat ODF format. There are helper functions inside
LibreOffice that then allow to serialize such SAX messages and send then
to LibreOffice importer interfaces.

I would love to see where you code is located and can help you with
advice how to integrate it. Nonetheless, if you are really writing
converter for Microsoft Works, it would be the best to simply contribute
to libwps instead of duplicating the work.

Cheers

Fridrich

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.