table content linespacing

Questions and answers on how to use DOCXReadWrite
Post Reply
isemago
Posts: 2
Joined: Tue Sep 20, 2022 11:04 am

table content linespacing

Post by isemago »

Hellow !

How can i doubled linespacing in table :?:

Code: Select all

    Table := aDocument.Paras.InsertTableAtPos(sel.FirstPos);
    Table.Name := vAliasName   
     table.AddRows(2, 3);
     for j := 0 to 2 do
     begin
       Table.Cells[0, j].Paras.PlainText := 'row ' + intToStr(j) + 'column 0';
       Table.Cells[1, j].Paras.PlainText :=  'row ' + intToStr(j) + 'column 1';
      end
 
     TableFormat:= TAXWPAPX.Create(aDocument.MasterPAP);
     TableFormat.LineSpacing := 2;
     Table.Paras.ApplyParaFormat(TableFormat, Table.FirstPara, Table.LastPara)
this doesn't work out.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: table content linespacing

Post by larsa »

Hello

You set the format for the table itself, not the cells.

To set the cells format, use this:

Code: Select all

   Table := FWriter.Editor.MainDoc.Paras.AddTable;

   TableFormat:= TAXWPAPX.Create(FWriter.Editor.MainDoc.MasterPAP);
   TableFormat.LineSpacing := 2;

   table.AddRows(2, 3);
   for j := 0 to 2 do begin
     Table.Cells[0, j].Paras.PlainText := 'row ' + intToStr(j) + 'column 0';
     Table.Cells[0, j].Paras.ApplyParaFormat(TableFormat,Table.Cells[0, j].Paras.First, Table.Cells[0, j].Paras.Last);

     Table.Cells[1, j].Paras.PlainText :=  'row ' + intToStr(j) + 'column 1';
     Table.Cells[1, j].Paras.ApplyParaFormat(TableFormat, Table.Cells[1, j].Paras.First, Table.Cells[1, j].Paras.Last);
    end;
Lars Arvidsson, Axolot Data
isemago
Posts: 2
Joined: Tue Sep 20, 2022 11:04 am

Re: table content linespacing

Post by isemago »

thanks !
Post Reply