The table is aligned to the center of the document, however when I load and save the tamplate it gets aligned to the right.
I have made a very simple test project to test this.
Code: Select all
docx := TDOCXReadWriteVcl.Create(nil);
docx.LoadFromFile(template.docx'); //template.docx contains table aligned to center
docx.SaveToFile('test.docx'); //saving the template aligns the table to the left
Code: Select all
//Loop through the entire document, check if paras = table, set PAPX.Alignment := axptaCenter
for i := 0 to WordDoc.Editor.Paras.Count - 1 do
begin
if WordDoc.Editor.Paras.Items[i].Type_ = alptTable then
begin
// WordDoc.Editor.Paras.Items[i].TempPAPX.Alignment := axptaCenter;
// WordDoc.Editor.Paras.ParaAtIndex(i).PAPX.Alignment := axptaCenter;
WordDoc.Editor.Paras.Items[i].Paras.Last.PAPX.Alignment := axptaCenter;
end;
end;
// WordDoc.Editor.Footers.AddDefault;
// WordDoc.Editor.Footers.Default_.Paras[1].PAPX.Alignment := axptaCenter;