Several print areas in one excel sheet

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
GerdK
Posts: 8
Joined: Tue Oct 28, 2008 2:46 pm

Several print areas in one excel sheet

Post by GerdK »

Hello,

we use the XLSReadWriteII component version 3.00.07 for Delphi 6. Now I want to set several print areas in one sheet. Code-example:

Code: Select all

var
  lXLS: TXLSReadWriteII2;
  lInternalName: TInternalName;
  lSheetIndex: integer;
begin
  lXLS := TXLSReadWriteII2.create(nil);
  try
    lSheetIndex := 0;

    lInternalName := lXLS.InternalNames.FindBuiltInName(bnPrintArea, lSheetIndex);
    if not (assigned(lInternalName)) then begin
      lInternalName := lXLS.InternalNames.Add;
      lInternalName.BuiltInName := bnPrintArea;
    end;
    lInternalName.Definition := 'Inhalt!$A$1:$W$81;Inhalt!$A$92:$W$136;Inhalt!$A$147:$W$199;Inhalt!$A$210:$W$244;Inhalt!$A$255:$W$333;'
      + 'Inhalt!$A$344:$W$423;Inhalt!$A$434:$W$484';
  finally
    lXLS.free;
  end;
end;


If I set the print areas manually in the excel sheet it works fine.
How can I set several print areas in one sheet with the XLSReadWriteII component?


Many thanks for help!

Regards,
Gerd K
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Post by larsa »

Hello

This is not possible right now, but it will be fixed in the next update.
Lars Arvidsson, Axolot Data
GerdK
Posts: 8
Joined: Tue Oct 28, 2008 2:46 pm

Re: Several print areas in one excel sheet

Post by GerdK »

Hello,

is the update now available?

Regards,
Gerd
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Several print areas in one excel sheet

Post by larsa »

Yes.
Lars Arvidsson, Axolot Data
GerdK
Posts: 8
Joined: Tue Oct 28, 2008 2:46 pm

Re: Several print areas in one excel sheet

Post by GerdK »

Hello,

is there an update for the version 3.0 available, or must I upgrade the version 3.0 to 4.0?
If there is an update available for the version 3.0, how can I download this?

Thanks for help!

Regards,
Gerd
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Several print areas in one excel sheet

Post by larsa »

Hello

Version 3 will not be updated.
Lars Arvidsson, Axolot Data
GerdK
Posts: 8
Joined: Tue Oct 28, 2008 2:46 pm

Re: Several print areas in one excel sheet

Post by GerdK »

Hello,

now I use the XLSReadWriteII component version 4.00.15 for Delphi 6. I use following code:

[code]
var
lXLS: TXLSReadWriteII4;
lInternalName: TInternalName;
lSheetIndex: integer;
begin
lXLS := TXLSReadWriteII4.create(nil);
try
lSheetIndex := 0;

lInternalName := lXLS.InternalNames.FindBuiltInName(bnPrintArea, lSheetIndex);
if not (assigned(lInternalName)) then begin
with lXLS.InternalNames.Add do begin
BuiltInName := bnPrintArea;
Definition := 'Inhalt!$A$1:$W$80;Inhalt!$A$91:$W$139;Inhalt!$A$150:$W$202;Inhalt!$A$213:$W$247;Inhalt!$A$258:$W$340;Inhalt!$A$351:$W$433;Inhalt!$A$444:$W$498;Inhalt!$A$509:$W$578';
end;
end else begin
lInternalName.Definition := 'Inhalt!$A$1:$W$80;Inhalt!$A$91:$W$139;Inhalt!$A$150:$W$202;Inhalt!$A$213:$W$247;Inhalt!$A$258:$W$340;Inhalt!$A$351:$W$433;Inhalt!$A$444:$W$498;Inhalt!$A$509:$W$578';
end;
finally
lXLS.free;
end;
end;
[/code]

At the command line "Definition := 'Inhalt!$A$1:$W$80;Inhalt!$A$91:$W$139;Inhalt!$A$150:$W$202;Inhalt!$A$213:$W$247;Inhalt!$A$258:$W$340;Inhalt!$A$351:$W$433;Inhalt!$A$444:$W$498;Inhalt!$A$509:$W$578';", I get the error "Name definition must be an area". When I use "Definition := 'Inhalt!$A$1:$D$10;Inhalt!$A$12:$D$20', I get no error.

If I set both print areas manually in the excel sheet, it works fine.
How can I set a large print area definition with the XLSReadWriteII component?

Many thanks for help!

Regards,
Gerd
GerdK
Posts: 8
Joined: Tue Oct 28, 2008 2:46 pm

Re: Several print areas in one excel sheet

Post by GerdK »

Hello,

I test it with Delphi 2007, MS Office 2003 and the XLSReadWriteII component version 4.00.15 (for Delphi 2007). I get the same error.
Is an update in planning which fix this error?

Many thanks for help!

Regards,
Gerd
Post Reply