Ask Your Question
1

Is there a way after programmatically opening a cwk file to programmatically determine whether the file is a word processing file (text) or a spreadsheet file? All the files are one or the other. [closed]

asked 2013-12-05 07:00:50 +0200

RussR gravatar image

I want to loop through a collection of cwk files. All the files are either word processing (text) files or spreadsheet files. Is there a way after opening the file programmatically to determine whether the cwk file is a text file (word processing) or a spreadsheet file. I want to save the text files as odt and close without saving the spreadsheet files. I am an experienced Excel VBA programmer. Looping through and opening should be straightforward from what I have read so far.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-16 00:25:36.069942

2 Answers

Sort by » oldest newest most voted
0

answered 2013-12-05 21:59:16 +0200

oweng gravatar image

updated 2013-12-05 21:59:56 +0200

According to this thread on the LO filter used for ClarisWorks / AppleWorks files it does not support the spreadsheet type of document. In my answer in that thread I provide a link to work done by Terrence Curran on trying to reverse-engineer the CWK format. I would start by looking at the source code of the work he has done.

edit flag offensive delete link more

Comments

Thanks for the link to Curran's work. I see he is opening and closing the files with Applescript which could be modified and embedded in Libreoffice basic. I have very little knowledge of Applescript. I was hoping to do the opening and saving or closing staying within Libreoffice basic. This is much more complicated than I had imagined as compared with doing something similar in Excel VBA. Thanks again for the link

RussR gravatar imageRussR ( 2013-12-06 01:48:03 +0200 )edit
0

answered 2013-12-05 12:35:25 +0200

RussR gravatar image

updated 2013-12-05 20:45:16 +0200

Suppose after I have opened the cwk file I try and execute a "save as" odt type. If the file is a text (word processing) file it will execute correctly. If it a spreadsheet type it will cause an error condition. If I trap the error condition I should be able to accomplish what I want. Will this work? I have the code that creates the file name with full path as a string. I am hung up on the call to the API to open the file which has a .cwk extension. I just want to open it and then save it as an .odt file.
Any help would be appreciated.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-12-05 07:00:50 +0200

Seen: 359 times

Last updated: Dec 05 '13