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

xcel to star cacl converter using the sdk api
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
nmaves
General User
General User


Joined: 12 Sep 2003
Posts: 10
Location: Denver,CO

PostPosted: Fri Sep 12, 2003 11:04 am    Post subject: xcel to star cacl converter using the sdk api Reply with quote

I have looked at the example in the oo sdk on how to convert documents using the api. I am having trouble running this as a standalone program and not a servlet. Anyone already tried this?

Please help I have a ton of xcel files that are eating up my drives.

nathan
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Mon Sep 15, 2003 9:56 am    Post subject: Re: xcel to star cacl converter using the sdk api Reply with quote

nmaves wrote:
Please help I have a ton of xcel files that are eating up my drives.


Is your problem simply that you want to convert a bunch of Excel files to OpenOffice.org?

If that is the case, then would it be adequate to simply have a Basic macro that opens a bunch of Excel files and saves new copies in OOo format?
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Sep 16, 2003 11:37 am    Post subject: Reply with quote

Just for fun, as an exercise, I tried a quick and dirty solution to the problem.

Code:
' Convert a bunch of Excel spreadsheets to OpenOffice.org calc spreadsheets.

Sub Main
   ' This is the hardcoded pathname to a folder containing Excel files.
   cFolder = "C:\Documents and Settings\dbrewer\Desktop\test"
   
   ' Get the pathname of each file within the folder.
   cFile = Dir$( cFolder + "/*.*" )
   Do While cFile <> ""
      ' If it is not a directory...
      If cFile <> "."  And  cFile <> ".." Then
         ' If it has the right suffix...
         If LCase( Right( cFile, 4 ) ) = ".xls" Then
            ' Open the document.
            oDoc = StarDesktop.loadComponentFromURL( ConvertToUrl( cFolder + "/" + cFile ), "_blank", 0, Array() )
            
            ' Prepare new filename
            cNewName = Left( cFile, Len( cFile ) - 4 )
            cNewName = cNewName + ".sxc"
            
            ' Save it in OOo format.
            oDoc.storeToURL( ConvertToUrl( cFolder + "/" + cNewName ), Array() )
            
            ' Close the document.
            oDoc.dispose()
         EndIf
      EndIf   
      cFile = Dir$
   Loop
End Sub


That was surprisingly short.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Gabor
Guest





PostPosted: Tue Sep 16, 2003 12:23 pm    Post subject: Batch convert Reply with quote

Dear Danny,
I have long been looking for a utility like the above macro of yours; this works marvelously on Excel files. However I almost permanently have to do different conversions (in Writer).

Could you please tell me what else do I have to change in it besides the extensions .xls and .sxc if I would like to use it for say .sxw to .rtf or .rtf to .txt (and the like).
I tried substituting .rtf for the first instance and .txt for the second but the result was a mess so I surely was wrong.

(I am really ashamed but I understand nothing of this special language.)
Gabor
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Sep 16, 2003 2:24 pm    Post subject: Re: Batch convert Reply with quote

Gabor wrote:
I almost permanently have to do different conversions (in Writer).

Could you please tell me what else do I have to change in it besides the extensions .xls and .sxc if I would like to use it for say .sxw to .rtf or .rtf to .txt (and the like).
I tried substituting .rtf for the first instance and .txt for the second but the result was a mess so I surely was wrong.


The macro code above, just does a loadComponentFromURL on the XLS file to open the Excel worksheet. I don't specify any particular filter to use. I just rely on the type autodetection to correctly open the document. I *assume* that it opened as a spreadsheet.

You mentioned two conversion cases...
SXW -> RTF
RTF -> TXT

In both cases, the *incomming* file extension is enough for OOo to know how to open it correctly. So just change the XLS to either SXW or RTF. I just experimentally confirmed that a single program code line such as....

Code:
oDoc = StarDesktop.loadComponentFromURL( ConvertToUrl( "c:\test.rtf" ), "_blank", 0, Array() )


will indeed open an RTF document without going through the hassle of specifying what filter to use.

Now the saving part is more tricky.

If you want to save a native OOo document, then just use the storeToURL() method.

If you want to save to a different output format, such as either RTF or TXT in your examples, then a filter must be used.

Here is an example that opens any document. Whatever the document is, it MUST end up in a Writer document, because we then save it as an RTF. So don't go using an extension like XLS. Smile

In this example, I do an RTF -> RTF conversion. You'll notice that I open an RTF file, then export it using the Rich Text Filter into another RTF file.

Code:
Sub Main
   ' Open the document.
   ' Just blindly assume that the document is of a type that OOo will
   '  correctly recognize and open -- without specifying an import filter.
   oDoc = StarDesktop.loadComponentFromURL( ConvertToUrl( "c:\test.rtf" ), "_blank", 0, Array() )


   ' Save the document using a filter.
   cUrl = ConvertToURL( "c:\test2.rtf" )
   
   oArgs = Array(_
            MakePropertyValue( "URL", cURL ),_
            MakePropertyValue( "FilterName", "Rich Text Format" ),_
            )
   
   oFrame = oDoc.getCurrentController().getFrame()
   
   oDispatcher = createUnoService( "com.sun.star.frame.DispatchHelper" )
   oDispatcher.executeDispatch( oFrame, ".uno:ExportTo", "", 0, oArgs() )
End Sub


Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function


This ends up converting from c:\test.rtf into c:\test2.rtf.

The real trick here is knowing what filter to specify. See the line that calls my function MakePropertyValue() setting the FilterName to "Rich Text Format". The trick is knowing a complete list of valid filter names.

What I usually do is drop into Python, then create a FilterFactory object

Code:
oFF = createUnoService( "com.sun.star.document.FilterFactory" )


And then look at the filter names it has...

Code:
oFF.getElementNames()


The list of filters available in OOo is truly impressive.

If you want to export to text, then replace a few of the above lines with...

Code:

.......
   cUrl = ConvertToURL( "c:\test3.txt" )
   
   oArgs = Array(_
            MakePropertyValue( "URL", cURL ),_
            MakePropertyValue( "FilterName", "Text" ),_
            )
.......


By combining these fragments of code with the above macro you should be able to import any of RTF or SXW, and then save as any of RTF, TXT or SXW.

Here are a few other filter names you might want to try for export purposes...

"writer_pdf_Export"

"writer_globaldocument_pdf_Export" (probably only when the source document is a "master" document in Writer -- whatever that means??)

I have not tried these last two, but you should be able to just replace "Rich Text Format" with "writer_pdf_Export", and use a suitable filename (not ending in RTF).

Hope this helps.

Danny
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Gabor
Guest





PostPosted: Tue Sep 16, 2003 2:37 pm    Post subject: Grateful Reply with quote

Thank you very much Danny!
At first sight I seem to understand what I am supposed to try to do. It was a major job from you to explain all this to a definitely unexperienced person.
Thank you again.
Gabor
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Sep 16, 2003 3:01 pm    Post subject: Re: Grateful Reply with quote

Gabor wrote:
At first sight I seem to understand what I am supposed to try to do. It was a major job from you to explain all this to a definitely unexperienced person.
Thank you again.r


You're welcome. Hope it helps.

My ulterior motive is, of course, that not only you, but others will read this, and understand.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Gabor
Guest





PostPosted: Tue Sep 16, 2003 3:49 pm    Post subject: Grateful Reply with quote

Thank you very much Danny!
At first sight I seem to understand what I am supposed to try to do. It was a major job from you to explain all this to a definitely unexperienced person.
Thank you again.
Gabor
Back to top
Gabor
Guest





PostPosted: Sat Sep 20, 2003 4:07 am    Post subject: I proved to be incompetent Reply with quote

Hi Danny,
I am not very proud to say that I could not overcome the difficulties.

You gave two codes in this thread.
This is the first for the questinon of the original poster:

This Converts a bunch of Excel spreadsheets to OpenOffice.org calc spreadsheets.

Code:
Sub Main
   ' This is the hardcoded pathname to a folder containing Excel files.
   cFolder = "C:\Documents and Settings\dbrewer\Desktop\test"
   
   ' Get the pathname of each file within the folder.
   cFile = Dir$( cFolder + "/*.*" )
   Do While cFile <> ""
      ' If it is not a directory...
      If cFile <> "."  And  cFile <> ".." Then
         ' If it has the right suffix...
         If LCase( Right( cFile, 4 ) ) = ".xls" Then
            ' Open the document.
            oDoc = StarDesktop.loadComponentFromURL( ConvertToUrl( cFolder + "/" + cFile ), "_blank", 0, Array() )
             
            ' Prepare new filename
            cNewName = Left( cFile, Len( cFile ) - 4 )
            cNewName = cNewName + ".sxc"
             
            ' Save it in OOo format.
            oDoc.storeToURL( ConvertToUrl( cFolder + "/" + cNewName ), Array() )
             
            ' Close the document.
            oDoc.dispose()
         EndIf
      EndIf   
      cFile = Dir$
   Loop
End Sub


It works nicely. However I was unable to combine its nice features
1. only the folder is hardcoded not the files themselves
2. it loops though all files in the folder coverting them one by one

I would like to convert a bunch of Writer files of THIS file type to THAT file type.
So, for my request and for the benefit of all in a similar need you posted the following. This is already a little bit modified version so that it could be more easily tested. (By this I mean that if the starting document is rtf and the result is rtf too, it is perhaps not so easy to see what actually happned and what did not. If the starting doc is sxw and the result is txt then the resulting file, after doubleclicking, will be opened by Notepad on Windows and the size will be revealing, too.)
I do stress that this one works fine and nice.

Code:
Sub ConvertANYTHING   
   ' Open the document.
   ' Just blindly assume that the document is of a type that OOo will
   '  correctly recognize and open -- without specifying an import filter.
   oDoc = StarDesktop.loadComponentFromURL( ConvertToUrl( "c:\test.sxw" ), "_blank", 0, Array() )

   cUrl = ConvertToURL( "c:\test.txt" )
   
   oArgs = Array(_
            MakePropertyValue( "URL", cURL ),_
            MakePropertyValue( "FilterName", "Text" ),_
            )
   
   oFrame = oDoc.getCurrentController().getFrame()
   
   oDispatcher = createUnoService( "com.sun.star.frame.DispatchHelper" )
   oDispatcher.executeDispatch( oFrame, ".uno:ExportTo", "", 0, oArgs() )
   oDoc.dispose()
End Sub

Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function



The only thing I could successfully transfer was the single line causing the opened starting document to close.

I could not transfer from code one to code second either of the two citeria mentioned in the numbered lines 1. and 2. above.

Could you perhaps help me out of this cul-de-sac?

BTW,
I think it is not only me who could very well use such a version in which even the folder is not hardcoded either. In my case I work with several small docs from day to day, they belong to different projects and within the projects there are several stages as well. The ideal would be to simply navigate the folder where the docs to be converted reside and convert them on the spot (i.e. within the actual folder: now this, than that and so on.)

Why the conversion? Because I have to send them out and since OOo is not well-spread (to say the least) in offices, they can read thed them only in MS-compatible forms. What is more, since Unicode was (in my opinion unfortunately) introduced (SO5.2 was free of it) not even QuarXpress 5 is able to import seamlessly all the special accented characters which are abundant in my native language. Text is thus a workaround in the worst case.

Thank you very much if you still have the patience to deal with almost the same problem for the millionth time.
Gabor
Back to top
Gabor
Guest





PostPosted: Sat Sep 20, 2003 5:03 am    Post subject: Just to add ruin to chaos... Reply with quote

... I tried to use the following combination. It works nice BUT it results in RTF instead of TXT. Which is like a nightmare for me since Rixh Text Format is on even mentioned. Still the resulting file (with a nice txt extension) contains this and more:
{\s3\li0\ri0\lin0\rin0\fi567\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ql\rtlch\af6\afs24\lang255\ltrch\dbch\af6\afs24\langfe255\loch\f0\fs24\lang1038\sbasedon1\snext3 First line indent;}
"Clear" rtf.

So the following does everything (except for navigating to the folder mentioned in my previous post) only the conversion is totall wrong

Code:
Sub TEST
   ' This is the hardcoded pathname to a folder containing files.
'   cFolder = "C:\Documents and Settings\dbrewer\Desktop\test"
   cFolder = "C:\Dokumentumok\##Convert"
   
   ' Get the pathname of each file within the folder.
   cFile = Dir$( cFolder + "/*.*" )
   Do While cFile <> ""
      ' If it is not a directory...
      If cFile <> "."  And  cFile <> ".." Then
         ' If it has the right suffix...
         If LCase( Right( cFile, 4 ) ) = ".sxw" Then
            ' Open the document.
            oDoc = StarDesktop.loadComponentFromURL( ConvertToUrl( cFolder + "/" + cFile ), "_blank", 0, Array() )
             
            ' Prepare new filename
            cNewName = Left( cFile, Len( cFile ) - 4 )
            cNewName = cNewName + ".txt"

'   ' Save the document using a filter.
'   cUrl = ConvertToURL( "c:\test2.rtf" )
'   
             
            ' Save it in OOo format.
            oDoc.storeToURL( ConvertToUrl( cFolder + "/" + cNewName ), Array() )
   oArgs = Array(_
            MakePropertyValue( "URL", cURL ),_
            MakePropertyValue( "FilterName", "Text" ),_
            )
             
            ' Close the document.
            oDoc.dispose()
         EndIf
      EndIf   
      cFile = Dir$
   Loop
End Sub

Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function


And , what is more, however I keep changing the input file type the output ffile type an the filter's name, the output filt is alwasy in rtf.
Sad
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Sat Sep 20, 2003 6:22 am    Post subject: Reply with quote

Here is what I think the fundamental misunderstanding is.

There are two templates that I use to write out a file.

If you want to EXPORT a file, that is, in some non-OOo format, then use this template...

Code:

   cUrl = ConvertToURL( cFolder + "/" + cNewName )
   
   oArgs = Array(_
            MakePropertyValue( "URL", cURL ),_
            MakePropertyValue( "FilterName", "Text" ),_
            )
   
   oFrame = oDoc.getCurrentController().getFrame()
   
   oDispatcher = createUnoService( "com.sun.star.frame.DispatchHelper" )
   oDispatcher.executeDispatch( oFrame, ".uno:ExportTo", "", 0, oArgs() )


If you wish to SAVE a document in native OOo format (different from exporting), then use this template....

Code:

' Save it in OOo format.
oDoc.storeToURL( ConvertToUrl( cFolder + "/" + cNewName ), Array() )


Do not use both templates, or do not combine them.

In both cases above you can see that the ConvertToURL function is what transforms your destination filename into a suitable URL.

In the EXPORT template, you see the MakePropertyValue line which sets up which FilterName to use? Here you would change the filter name to one of the ones I've mentioned previously such as "Text" or "Rich Text Format". But you can't just make this up. It must be a valid name of a registered filter within OOo. Maybe later today if I go in to my office, or if I try to get Python connected to OOo at home on Linux, I will produce a complete list of the valid filter names, and post them here.

As a result of your difficulties, I am considering creating a new power tool that can convert a batch of documents from one type to another type. This might be potentially useful to you and also to the original poster of this thread. It is even possible that others could find it useful.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Sat Sep 20, 2003 1:45 pm    Post subject: Reply with quote

I mentioend previously that I was on the verge of working out a shorter simpler idiom for exporting documents. I was sure I could do this from the API. But I just hadn't gotten it to work in my previous experiments.

Here is how to do it.

If you are saving to a native OOo document, then do this....

Code:
 ' Save it in OOo format.
oDoc.storeToURL( ConvertToUrl( cFolder + "/" + cNewName ), Array() )


If you are exporting to a non-native format, then do this....

Code:

   oDoc.storeToURL( ConvertToUrl( cFolder + "/" + cNewName ),_
      Array( MakePropertyValue( "FilterName", "Text" ) ))


(This last snippet of code is based on the new technique, but I cobbled it together here on the web browser, so I didn't actually copy this from a working example.)

The idea is that storeToURL can accept an array of property values. The only property value you need is the filter name. This avoids the whole business of getting the dispatcher, or the document's controller's frame and executing a dispatch. Much cleaner and shorter.

The "Text" after the "FilterName" can be replaced with any valid filter name, such as "Rich Text Format".


Here is the very crude beginnings of a utility

http://kosh.datateamsys.com/~danny/OOo/Tools/

that uses the new technique to export documents.


As I promised earlier, here is a complete list of all of the filter names in OOo. (As of 1.1 RC on Windows.)

From the list below, you can see where I got the two filter names "Text" and "Rich Text Format".

Code:

(u'AportisDoc Palm DB',
u'BMP - MS Windows',
u'CGM - Computer Graphics Metafile',
u'DIF',
u'DXF - AutoCAD Interchange',
u'DocBook File',
u'EMF - MS Windows Metafile',
u'EPS - Encapsulated PostScript',
u'Flat XML File',
u'GIF - Graphics Interchange',
u'HTML',
u'HTML (StarCalc)',
u'HTML (StarWriter)',
u'JPG - JPEG',
u'Lotus',
u'MET - OS/2 Metafile',
u'MS Excel 4.0',
u'MS Excel 4.0 Vorlage/Template',
u'MS Excel 5.0/95',
u'MS Excel 5.0/95 Vorlage/Template',
u'MS Excel 95',
u'MS Excel 95 Vorlage/Template',
u'MS Excel 97',
u'MS Excel 97 Vorlage/Template',
u'MS PowerPoint 97',
u'MS PowerPoint 97 Vorlage',
u'MS WinWord 6.0',
u'MS Word 95',
u'MS Word 95 Vorlage',
u'MS Word 97',
u'MS Word 97 Vorlage',
u'MathML XML (Math)',
u'MathType 3.x',
u'Microsoft Word 2003 XML',
u'PBM - Portable Bitmap',
u'PCT - Mac Pict',
u'PCX - Zsoft Paintbrush',
u'PGM - Portable Graymap',
u'PNG - Portable Network Graphic',
u'PPM - Portable Pixelmap',
u'PSD - Adobe Photoshop',
u'RAS - Sun Rasterfile',
u'Rich Text Format',
u'Rich Text Format (StarCalc)',
u'SGF - StarOffice Writer SGF',
u'SGV - StarDraw 2.0',
u'SVM - StarView Metafile',
u'SYLK',
u'StarCalc 1.0',
u'StarCalc 3.0',
u'StarCalc 3.0 Vorlage/Template',
u'StarCalc 4.0',
u'StarCalc 4.0 Vorlage/Template',
u'StarCalc 5.0',
u'StarCalc 5.0 Vorlage/Template',
u'StarChart 3.0',
u'StarChart 4.0',
u'StarChart 5.0',
u'StarDraw 3.0',
u'StarDraw 3.0 (StarImpress)',
u'StarDraw 3.0 Vorlage',
u'StarDraw 3.0 Vorlage (StarImpress)',
u'StarDraw 5.0',
u'StarDraw 5.0 (StarImpress)',
u'StarDraw 5.0 Vorlage',
u'StarDraw 5.0 Vorlage (StarImpress)',
u'StarImpress 4.0',
u'StarImpress 4.0 Vorlage',
u'StarImpress 5.0',
u'StarImpress 5.0 (packed)',
u'StarImpress 5.0 Vorlage',
u'StarMath 2.0',
u'StarMath 3.0',
u'StarMath 4.0',
u'StarMath 5.0',
u'StarOffice XML (Calc)',
u'StarOffice XML (Chart)',
u'StarOffice XML (Draw)',
u'StarOffice XML (Impress)',
u'StarOffice XML (Math)',
u'StarOffice XML (Writer)',
u'StarWriter 1.0',
u'StarWriter 2.0',
u'StarWriter 3.0',
u'StarWriter 3.0 (StarWriter/GlobalDocument)',
u'StarWriter 3.0 (StarWriter/Web)',
u'StarWriter 3.0 Vorlage/Template',
u'StarWriter 4.0',
u'StarWriter 4.0 (StarWriter/GlobalDocument)',
u'StarWriter 4.0 (StarWriter/Web)',
u'StarWriter 4.0 Vorlage/Template',
u'StarWriter 4.0/GlobalDocument',
u'StarWriter 5.0',
u'StarWriter 5.0 (StarWriter/GlobalDocument)',
u'StarWriter 5.0 (StarWriter/Web)',
u'StarWriter 5.0 Vorlage/Template',
u'StarWriter 5.0/GlobalDocument',
u'StarWriter DOS',
u'StarWriter/Web 4.0 Vorlage/Template',
u'StarWriter/Web 5.0 Vorlage/Template',
u'TGA - Truevision TARGA',
u'TIF - Tag Image File',
u'Text',
u'Text (StarWriter/Web)',
u'Text (encoded)',
u'Text (encoded) (StarWriter/GlobalDocument)',
u'Text (encoded) (StarWriter/Web)',
u'Text - txt - csv (StarCalc)',
u'WMF - MS Windows Metafile',
u'XBM - X-Consortium',
u'XHTML File',
u'XPM',
u'bmp_Export',
u'bmp_Import',
u'calc_HTML_WebQuery',
u'calc_StarOffice_XML_Calc_Template',
u'calc_pdf_Export',
u'dBase',
u'draw_PCD_Photo_CD_Base',
u'draw_PCD_Photo_CD_Base16',
u'draw_PCD_Photo_CD_Base4',
u'draw_StarOffice_XML_Draw_Template',
u'draw_bmp_Export',
u'draw_emf_Export',
u'draw_eps_Export',
u'draw_flash_Export',
u'draw_gif_Export',
u'draw_html_Export',
u'draw_jpg_Export',
u'draw_met_Export',
u'draw_pbm_Export',
u'draw_pct_Export',
u'draw_pdf_Export',
u'draw_pgm_Export',
u'draw_png_Export',
u'draw_ppm_Export',
u'draw_ras_Export',
u'draw_svg_Export',
u'draw_svm_Export',
u'draw_tif_Export',
u'draw_wmf_Export',
u'draw_xpm_Export',
u'dxf_Import',
u'emf_Export',
u'emf_Import',
u'eps_Export',
u'eps_Import',
u'gif_Export',
u'gif_Import',
u'impress_StarOffice_XML_Draw',
u'impress_StarOffice_XML_Impress_Template',
u'impress_bmp_Export',
u'impress_emf_Export',
u'impress_eps_Export',
u'impress_flash_Export',
u'impress_gif_Export',
u'impress_html_Export',
u'impress_jpg_Export',
u'impress_met_Export',
u'impress_pbm_Export',
u'impress_pct_Export',
u'impress_pdf_Export',
u'impress_pgm_Export',
u'impress_png_Export',
u'impress_ppm_Export',
u'impress_ras_Export',
u'impress_svg_Export',
u'impress_svm_Export',
u'impress_tif_Export',
u'impress_wmf_Export',
u'impress_xpm_Export',
u'jpg_Export',
u'jpg_Import',
u'math_pdf_Export',
u'met_Export',
u'met_Import',
u'pbm_Export',
u'pbm_Import',
u'pcd_Import_Base',
u'pcd_Import_Base16',
u'pcd_Import_Base4',
u'pct_Export',
u'pct_Import',
u'pcx_Import',
u'pgm_Export',
u'pgm_Import',
u'placeware_Export',
u'png_Export',
u'png_Import',
u'ppm_Export',
u'ppm_Import',
u'psd_Import',
u'ras_Export',
u'ras_Import',
u'sgf_Import',
u'sgv_Import',
u'svg_Export',
u'svm_Export',
u'svm_Import',
u'tga_Import',
u'tif_Export',
u'tif_Import',
u'wmf_Export',
u'wmf_Import',
u'writer_StarOffice_XML_Writer_Template',
u'writer_globaldocument_StarOffice_XML_Writer',
u'writer_globaldocument_StarOffice_XML_Writer_GlobalDocument',
u'writer_globaldocument_pdf_Export',
u'writer_pdf_Export',
u'writer_web_HTML_help',
u'writer_web_StarOffice_XML_Writer',
u'writer_web_StarOffice_XML_Writer_Web_Template',
u'writer_web_pdf_Export',
u'xbm_Import',
u'xpm_Export',
u'xpm_Import')

_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Gabor
Super User
Super User


Joined: 21 Sep 2003
Posts: 610
Location: Hungary (E-Europe)

PostPosted: Sun Sep 21, 2003 4:13 am    Post subject: Success Reply with quote

I indeed know nothing about the difference between "save as" and export to" either as philosophy beneath or practice on the surface.

But I could perfectly understand your instructions on what to use and what not to use - and now I have three different fine converters which perform their duties in the hard-coded folder seamlessly.

Also I have your Document Converter which works easier and better then anything I would have thought of and quicker than any I knew since there is no need to add files one by one.

This is a major tool, and I think if you decide later to add a facility by which users could switch to their local language by a click, that would be a benefit for some or several.
In my country (Hungary, E-Europe) for instance few speak foreign languages on an acceptable level or at all. OOo is new (perhaps spreading now a bit quicker since brand new PC-s may now be bought under fairly good governmet-supported financial conditions whit OOo [localised] installed).
Your tool may be of very good use since the proprietary MS formats are generally used here which do not recognize OOo.

So if you happen to publish a numbered list of all the texts in the windows of your tool which someone may then translate into the native language (considering number of characters and such), send the result to you and you include it in the language options than I would happily produce the Hungarian version. However that would need continuous maintenance on your part or from someone maintaining a site for your and others' macros, like
[url]http://www.ooomacros.org/[/url]

Also, may I ask if it were not somewhat better if the row for the insertion of the source folder would come up totally blank?
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Sun Sep 21, 2003 8:57 am    Post subject: Reply with quote

I'm glad you understood how to build the hardcoded scripts. Did you try the new export technique?

I was able to spend some hours on the document converter yesterday, getting it into its first crude form. It will improve with time. I had to learn some new things along the way.

The document converter is getting a number of improvements. Larger combination of import/export formats. (i.e. it will know how to use a larger subset of the OOo filters.) My program does not do the actual conversion work. It merely drives OOo to read and write documents.

As for adding support for other languages that may be a problem. What do you call someone who speaks three languages? (Answer: Trilingual). What do you call someone who speaks two languages? (Answer: Bilingual) What do you call someone who speaks one language?

(Answer: American)

So one difficulty of a multi-language version is finding a translator. Second difficulty is technical. The program would have to be greatly expanded to dynamically change all the texts of all the controls on all of the pages of the dialog. Those texts would need to systematically come from some organized location. Finally, there is a logistical difficulty. The translation effort needs to be maintained in parallel with the program. As the program evolves, the translation work needs to keep pace with it.

In short, for a Basic macro, a much better solution is this. Wait a bit until the macro is fairly mature. Then get someone to translate it once. Just go into the Basic IDE and edit all the text on all the dialog pages. The program is under the LGPL license, so anyone is free to alter it and redistribute it. I would be happy for you to provide a Hungarian translation. I can give you instructions on how to find all the strings that need altered. Again, it would be good to hold off until the macro becomes more mature. It would be good if you submitted your translated version to OOoMacros.org.

There are two major categories of strings that would need to be translated:
1. texts in the dialog box
2. texts in the program.

In the program, search for things lke MsgBox() and setText(). There are likely places where translations are necessary.

In the program, see the constants that look like this....

Const PAGE_WRITER_SOURCE_TYPE = 71

This means that page 71 of the dialog box is the page where you pick which kind of Writer type to import. On the dialog box, if you click the outer edge of the dialog box frame, you'll see the dialog box get little green handles. When the dialog box is selected, in the properties window, change the Page (Step) to 71,and you'll see the controls for this page. You can then select any text, field, option button or other control and translate its text. You'll ned to translate all of the dialog pages. Each page has a constant in the program of the form.... Const PAGE_XXXX = xx like the above.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Gabor
Super User
Super User


Joined: 21 Sep 2003
Posts: 610
Location: Hungary (E-Europe)

PostPosted: Sun Sep 21, 2003 3:20 pm    Post subject: Absolutely right Reply with quote

You are absolutely right about what the maintenance would involve and your suggestion about the translation is much more practicable.

I will try to find and see as much as I can but it seems quite probable that I myself would prove incapable of this high level work. (A list of words and sentences is totally different because it is just a question of human language.)

But I will try to do my best to draw attention to this fine and eays-to-use utility in OOo forums in Hungary. Again you are right: it would be reasonable to wait until you say you don't need or intend to invest much more time and energy into the converter.
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 Macros and API All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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