certain sheet

Questions and answers on how to use XLSSpreadSheet.
Post Reply
ktollund
Posts: 9
Joined: Mon Sep 29, 2008 10:45 pm

certain sheet

Post by ktollund »

Hi
I would like to open an excel-file and look at at certain sheet, and on the other hand I would like to know what sheet is active.
But I can't make it function.
I use XLSSpreadSheet in Delphi 7

King regards
Kenneth
ktollund
Posts: 9
Joined: Mon Sep 29, 2008 10:45 pm

Problem solved. Another problem:

Post by ktollund »

I have found the solution. By looking at the advertising of XLSSpreadSheet on this site I found that I have to use XLSReadWriteII4:
[quote]
as all control of the Excel data is trough the XLSReadWriteII object of XLSSpreadSheet.
[unquote]

But then I got another problem:
After having written to an excelfile, the sheets are protected, at if I try to open the file I get an access error.
When I use Excel to remove the protection I can open the file again.
But how do I avoid that the WorkBook or the sheets get protected? - Or how do I remove the protection programmatically?

Kind regards
Kenneth
ktollund
Posts: 9
Joined: Mon Sep 29, 2008 10:45 pm

new download

Post by ktollund »

In order to try to adress my problems, I downloaded new versions of XLSReadWriteII4 and XLSSpreadSheet (the dcu' s are dated 03.10.08 12:06).
When I only use XLS.Read and XLS.Write it works.
But when I try to use the XLSSpreadSheet I get an error:

[Fatal Error] Unit1.pas: Unit XBookPaintGDI was compiled with a different version of CellFormats4.TCellFormats

So what now???

Kind regards
Kenneth
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Post by larsa »

Hello

You probably have an old version (i.e. not the latest update) of XLSReadWriteII. If you download XLSSpreadSheet, always download XLSReadWriteII at the same time, to ensure that you have the altest versions of both.
Lars Arvidsson, Axolot Data
ktollund
Posts: 9
Joined: Mon Sep 29, 2008 10:45 pm

Post by ktollund »

Thank you for your reply. I have had the same idea, and I have removed any trace of earlier version of XLS components.
I have downloaded XLSReadWriteII 4 and XLSSpreadSheet simultaneusly and have re-installed them

To test the installation I made a form with the XLSSpreadSheet and opened a file. This is all I do:

procedure TForm1.FormActivate(Sender: TObject);
begin
XLSSpreadSheet1.XLS.Filename:='c:\tmp\Excelimport.xlsx';
XLSSpreadSheet1.XLS.Read;
XLSSpreadSheet1.XLS.Sheets[0].AsInteger[1,2]:=7;
XLSSpreadSheet1.XLS.Write;
end;

But I get an Access violation at address 004DECCB, and this points at:

if (Col = FActiveCol) and (Row = FActiveRow) then
AreaHit := sahActiveCell;

in the file SheetData4

Do you have an idea?

Kindly Kenneth
ktollund
Posts: 9
Joined: Mon Sep 29, 2008 10:45 pm

solved

Post by ktollund »

Please don't waste anymore time on this.

If I write
XLSSpreadSheet1.Filename:=....
XLSSpreadSheet1.Read

in stead of
XLSSpreadSheet1.XLS.Filename:=....
XLSSpreadSheet1.XLS.Read

it works.
So all I need is a small manual to XLSSpreadSheet to help me get the syntax right. That way we can all get some more sleep.

Kind regards
Kenneth
Post Reply