ExcelWriter (creates MS-Excel '97 compatible files)

Developed or developing a new product in PureBasic? Tell the world about it.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

ExcelWriter (creates MS-Excel '97 compatible files)

Post by ABBKlaus »

Hi,

i made a conversion of the excelapi from Paul Squires. (see here http://www.planetsquires.com)

http://www.purebasicpower.de/?ExcelWriter

Klaus
Last edited by ABBKlaus on Mon Jan 05, 2009 7:40 pm, edited 3 times in total.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2810
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Well i've seen that it doesn't require F64 lib anymore, but it just creates a blank document for me...
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

the example with the XIncludeFile does not need the F64 lib its only for PB4 Beta !
but i can´t reproduce your problem with the blank file, the example i delivered just works fine here.
can you put a snippet together and post it here :?:
you can also debug each command :

Code: Select all

XIncludeFile("Source\ExcelWriter_res.pb")
XIncludeFile("Source\ExcelWriter.pb")

XLS_Init() ; Wichtig !!! muss hier stehen ist ja keine PB lib

Debug XLS_CreateFile("C:\Data\Test.xls")
Debug GetLastError_()

Debug XLS_PrintGridLines(#False)
Debug GetLastError_()
Klaus
Num3
PureBasic Expert
PureBasic Expert
Posts: 2810
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Tried that and - No errors! :shock:

I just get a 900kb empty file...

I wonder if it has something to do with using OpenOffice...
I find the size too big, for such a small output...
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

In opencalc i see nothing, but in excel is good :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post by Droopy »

Very useful, thanks a lot :D
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

hello,

i began a lib (pb4) for writing excel files in XML format.
Since MS Office use this format it becames much easier to implement.

you might be interested in this try - ( just a start - not a full featured lib )

PureXLS -> UserLib_PB40_PureXLS.zip
Image

here is how xml tags are organized :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<Workbook>
   
    <Styles>
        <Style>
            <Alignment/>
            <Borders>
                <Border/>
            </Borders>
            <Font/>
            <Interior/>
        </Style>
    </Styles>
   
    <Worksheet>
        <Table>
            <Column/>
            <Row>
                <Cell>
                    <Data/>
                </Cell>
            </Row>
        </Table>
    </Worksheet>

</Workbook>
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

Flype wrote:hello,

i began a lib (pb4) for writing excel files in XML format.
Since MS Office use this format it becames much easier to implement.
don't works in Office 2000 :?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

oh sorry, i forgot to say that MS Office understand XML Worksheets only since MS Office XP/2002/2003/+
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

recompiled for PB4.10 Final :!:

http://www.purebasicpower.de/?ExcelWriter
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Thanks alot for this. Looks very useful. However I quickly tried the supplied example to write out some unicode text, and open the resultant excel file and the text appeared as garbage chars instead of the Japanese text I typed (compiled with UTF-8 source & set compile to unicode & specified subsystem 'UserLibUnicode'). I also tried changing the font to a Japanese one, but same result. Has the unicode version been tested? Thanks again.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

I cannot get it to work in 4.2b2

I get the same error attempting to run the example code:

http://www.bluemesapc.com/image/excelwrite1.jpg

What am I not doing.

And how many of those User Libraries do I have to install? :D
Last edited by Rook Zimbabwe on Tue Mar 04, 2008 4:17 pm, edited 2 times in total.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

I remmed out:



; XLS_Init() ; Wichtig !!! muss hier stehen ist ja keine PB lib

Debug XLS_CreateFile("C:\Data\Test.xls")
Debug GetLastError_()

And debug showed
0
6
0
6
But it appears to have worked... the file exists. 4.1 not 4.2b2

And I have to put the two resource files in the same directory as the program.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

Sorry Rook, i had no time to compile a new userlib for Beta2.
You could use it as include file :

Code: Select all

XIncludeFile #PB_Compiler_Home+"Examples\Excel_Writer\Source\ExcelWriter.pb"
;include the resident file if needed
XIncludeFile #PB_Compiler_Home+"Examples\Excel_Writer\Source\ExcelWriter_res.pb"
;Init
XLS_Init()
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

I keep getting this error

Mind yuo, I am not using UNICODE or threadsafe...

Image

:?:

It opens one of the include files and stops on that line...
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply