restrict printing area

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
Guest
Posts: 83
Joined: Tue Aug 16, 2005 6:08 pm

restrict printing area

Post by Guest »

Hi!
How can I restrict printing area? e.g. I have filled 10 colums on my grid, and I need print only first 8 columns.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Post by larsa »

Hello

How do you do it in excel?


Lars Arvidsson
Guest
Posts: 83
Joined: Tue Aug 16, 2005 6:08 pm

Post by Guest »

Hello!
I have russian version of ms office 2003. Sorry for some small mistakes in description (if they would).

I select some area by mouse in my excel-document. Then I press menu item File/Print Area/Set. And when I try to show print preview, excel show me only fields, witch are in selection area.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Post by larsa »

Hello

You set the print are with IntrnalNames. Example:

Code: Select all

  with XLS.InternalNames.Add do begin
    BuiltInName := bnPrintArea;
    Definition := 'Sheet1!$D$4:$G$10';
  end;
Lars Arvidsson
Guest
Posts: 83
Joined: Tue Aug 16, 2005 6:08 pm

Post by Guest »

Hello!

Why at opening a file there is a mistake?

Code: Select all

           xls.Filename := 'c:\1.xls';
           xls.Sheets[0].Name := 'A';
            with xls.InternalNames.Add do
             begin
                BuiltInName := bnPrintArea;
                Definition := 'A!$D$4:$G$10';
             end;
              xls.Sheets.Add;
              xls.Sheets[1].Name := 'S';
            with xls.InternalNames.Add do
             begin
                BuiltInName := bnPrintArea;
                Definition := 'S!$D$4:$G$10';
             end;

              xls.Sheets.Add;
              xls.Sheets[1].Name := 'D';
            with xls.InternalNames.Add do
             begin
                BuiltInName := bnPrintArea;
                Definition := 'D!$D$4:$G$10';
             end;




Post Reply