DOCXReadWriteVCL page columns

Questions and answers on how to use DOCXReadWrite
Post Reply
dchobanov
Posts: 1
Joined: Sun Feb 12, 2023 9:46 am

DOCXReadWriteVCL page columns

Post by dchobanov »

Hello,
Does TDOCXReadWriteVcl support page columns, if not what should I repalce it with?
DiBase
Posts: 13
Joined: Wed Feb 16, 2022 9:41 pm

Re: DOCXReadWriteVCL page columns

Post by DiBase »

Yes, this is possible. I was just searching for the same topic.

The way I found was to add a "section change" (TAXWSEP). A section change has to be added at the end of a section or document (and is effective for the lines above).

So you have to add these lines at the end of your document (in C++ code):

Code: Select all

	...  // here your document code
	
	Para = DOCX->Editor->Paras->AppendPara( "" );
	{
		TAXWSEP  *SEP;

		SEP = Para->AddSEP( DOCX->Editor->SEP , NULL , astContinous );
		SEP->AddCols( 2 , 0 );
	}
In Pascal code the same looks like this:

Code: Select all

var
  ...
  SEP: TAXWSEP;
begin
  ...  // here your document code

  Para := DOCX.Editor.Paras.AppendPara( '' );
  SEP := Para.AddSEP( DOCX.Editor.SEP , nil , astContinous );
  SEP.AddCols( 2 , 0 );
end;
This works in docx output only. Sadly not in preview or pdf output.

- Dirk
DiBase
Posts: 13
Joined: Wed Feb 16, 2022 9:41 pm

Re: DOCXReadWriteVCL page columns

Post by DiBase »

I found a much more shorter code to make the whole document multi-column:

Code: Select all

DOCX.Editor.SEP.AddCols( 2 , 20 );
First argument is the number of colums and second argument is the width of the gap between the columns (don't know in which unit).

- Dirk
Post Reply