XLTable, dll for easy reading
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
XLTable, dll for easy reading
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
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
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Is there a way of reading excell sheets using the database commands?
-Anthony
-Anthony
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
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.
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Paul: Thats sounds really useful, have you any examples?
-Anthony
-Anthony
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
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.
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.
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
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
XLTable DLL Wrapper Lib v.1.0