Page 1 of 1

DOCXReadWriteVCL page columns

Posted: Mon Feb 13, 2023 10:38 am
by dchobanov
Hello,
Does TDOCXReadWriteVcl support page columns, if not what should I repalce it with?

Re: DOCXReadWriteVCL page columns

Posted: Fri Mar 03, 2023 4:06 pm
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

Re: DOCXReadWriteVCL page columns

Posted: Fri Mar 03, 2023 5:02 pm
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