Page 1 of 1

XLTable, dll for easy reading

Posted: Sun Apr 24, 2005 11:13 am
by Edwin Knoppert
I ever wrote a dll which can fetch values and text's from Excel sheets.
It does need Excel as well though.

The calls are for PowerBASIC but would be easy to rewrite for PureBasic.. anyone?

Also note the BSTR topic/issue in the help.
This dll uses BSTR's and you'll need a small wrapper, see the help for code.

http://www.hellobasic.com/cgi-bin/forum ... 1113217473

Posted: Sun Apr 24, 2005 5:06 pm
by Paul
Just curious, how would using this DLL have an advantage over using PureBasic's Database commands ?

Posted: Sun Apr 24, 2005 9:49 pm
by DoubleDutch
Is there a way of reading excell sheets using the database commands?

-Anthony

Posted: Sun Apr 24, 2005 10:24 pm
by Paul
DoubleDutch wrote:Is there a way of reading excell sheets using the database commands?

-Anthony
Of course :)

PureBasic database commands allow you to talk to your databases through an ODBC connection using SQL syntax.

Posted: Sun Apr 24, 2005 10:44 pm
by jack
this may be of interest. ExcelAPI
Paul Squires wrote:Create BIFF 2.1 compatible Excel files directly without using any DLL's (no need for JET, ADO/DAO). Handles writing text, numbers and dates, headers, footers, fonts, cell formatting, column and row heights, hidden cells, locked cells and protected spreadsheets. Does not handle formulas. This is award winning code as shown on PlanetSourceCode.

Posted: Sun Apr 24, 2005 11:15 pm
by DoubleDutch
Paul: Thats sounds really useful, have you any examples?

-Anthony

Posted: Sun Apr 24, 2005 11:37 pm
by jack
ExcelAPI comes in source code for VisualBasic and PowerBasic, and includes examples. :)

Posted: Mon Apr 25, 2005 9:07 am
by Edwin Knoppert
There are always people who actually welcome an easy to use method.
Of course, several other and even better options.

Posted: Wed Apr 27, 2005 9:10 am
by Edwin Knoppert
I have noticed some remarks in a german forum about the single and BSTR issue.
I will reply over here since i can better do this in english than my poor german.

About the single, in PowerBASIC it still runs the following line well:

& "Single: " & Chr$( 9 ) & Trim$( Str$( Excel_XLTable_GetCellAsSingleEx( hXLTable, 2, 5, 1 ) ) ) & $CrLf _

Also added this test line in the VB6 example:
& vbTab & ">> " & Excel_XLTable_GetCellAsSingleEx(hXLTable, 2, nRow, 1) _

both worked well..
You might want to use Val( Excel_XLTable_GetCellAsString(...)) evt.

-------------------------

About the BSTR, this is always an ansi version, not unicode.
Both PowerBASIC and VB6 handle these strings 100%

A BSTR has certainly a benefit, it's a null terminated memory buffer with length indicator, how much better can you get it.
I often stated the BSTR's should be part in PureBasic as well.
All com interfaces use BSTR's (unicode though)

Benefit is that under normal cirumstances you don't need to provide a buffer to be filled.
Also the length doesn't need to determined before you can prepare a buffer.
This often results in performing the task twice!
Using BSTR's you can prevent this 100%.

Sine PB can't handle BSTR's you are out of luck and a simple wrapper is required.
Still, the data did not had to determine it's size twice.

Posted: Wed Apr 27, 2005 9:11 am
by Edwin Knoppert
To determine if a cell is a value use: Excel_XLTable_CellIsValue( ... )

Posted: Thu May 12, 2005 1:48 am
by ts-soft
i have make a little wrapper userlib with TailBite 1.2 PR 1.0, you can download this (including source and example) at purearea.net in showcase
XLTable DLL Wrapper Lib v.1.0