Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 12-13-2010, 06:40 PM
axxa axxa is offline
Member
 
Join Date: Oct 2009
Posts: 37
Unhappy Automation MS Word, Headings Rows Repeat - don't works?!

Hi everybody!

With this code I try to make a table in MS Word, with the first row repeated as header row at the top of each page.
The code is simple. It create a word document with table. In this document, the Table -> Headings Rows Repeat is checked.

But in the second page, isn't row header.
I don't understand why.

If unchecked, and checked Table -> Headings Rows Repeat the row header appears on second page.

Please help me if you have any idea to solve this problem.

Thank you very much...

Code:
procedure TForm1.abcWord;
var
word,wrdDoc: OleVariant;
wrdSelection, myCell, wrdTable: OleVariant;
begin

    Word := CreateOleObject('Word.Application');
    wrdDoc := Word.Documents.Add();
    Word.Visible := True;

    wrdSelection := Word.Selection;

    wrdDoc.Tables.Add(Range:=wrdSelection.Range, NumRows:=60, NumColumns:=6);
    wrdDoc.Tables.Item(1).Borders.InsideLineStyle := True;
    wrdDoc.Tables.Item(1).Borders.OutsideLineStyle := True;

    wrdDoc.Tables.Item(1).Borders.Item(wdBorderLeft).LineStyle:=wdLineStyleSingle;
    wrdDoc.Tables.Item(1).Borders.Item(wdBorderRight).LineStyle:=wdLineStyleSingle;

  wrdDoc.Tables.Item(1).Borders.Item(wdBorderTop).LineStyle:=wdLineStyleSingle;            
 wrdDoc.Tables.Item(1).Borders.Item(wdBorderBottom).LineStyle:=wdLineStyleSingle;

    wrdDoc.Tables.Item(1).Cell(1, 1).Range.Text :='C1';
    wrdDoc.Tables.Item(1).Cell(1, 2).Range.Text :='C2';
    wrdDoc.Tables.Item(1).Cell(1, 3).Range.Text :='C3';
    wrdDoc.Tables.Item(1).Cell(1, 4).Range.Text := 'C4';
    wrdDoc.Tables.Item(1).Cell(1, 5).Range.Text := 'C5';
    wrdDoc.Tables.Item(1).Cell(1, 6).Range.Text := 'C6';

    wrdDoc.Tables.Item(1).cell(1,1).select;

    word.Selection.Tables.Item(1).Rows.HeadingFormat:= true;
    word.Selection.Tables.Item(1).Rows.HeadingFormat:= false;
    word.Selection.Tables.Item(1).Rows.HeadingFormat:= true;

end;
  #2  
Old 12-17-2010, 05:27 PM
axxa axxa is offline
Member
 
Join Date: Oct 2009
Posts: 37
Default

Finally, after I select the first table rouw, I write this:
Code:
 Word.Selection.Rows.HeadingFormat:=-1;
and works fine.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:37 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.