AsposeTest.zip (29.1 KB)
attached is my project and my result.
if I remove the first row of the second table in the template, the entire table is moving to the left side of the page.
How can I get it to NOT move?
note : the table’s left indent is 0, however, it’s located to the right side of the page.
also note: if the first row is not deleted, it stays in place
AsposeTest.zip (29.1 KB)
We have generated an output (see 18.3.zip (8.1 KB)) by using the latest version of Aspose.Words for .NET i.e. 18.3. Can you please highlight the problematic areas in this 18.3.docx? Please also ZIP and upload your expected Word document showing the correct output. You can use MS Word to create expected document for our reference.
If you look at the source dot, the table that is filled with the ‘claiminfo’ value is on the right.
when you look at result doc, that table is filled with ‘Claim #: 654321’, and is on the left.
and it goes to the left, because I call firstRow.remove().
attached is the result.docx, which was generated through aspose 18.3, but with the table in the correct place.
expected.zip (14.8 KB)
We are working on your query and will get back to you soon.
We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16595. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.
any word on if/when this will be fixed.
I have some pretty antsy clients, getting even antsier…
Unfortunately, your issue is not resolved yet. We have completed the analysis of this issue and the root cause has been identified. We will inform you via this thread as soon as this issue is resolved or any estimates are available. We apologize for your inconvenience. In the meantime, please see the following workaround.
Problem occurs because MS Word takes basic row level formatting for entire table from the first row, which was removed. So, preferred width for the table takes from the second row, which has percent type of preferred width (<w:tblW w:w=“0” w:type=“auto” />). It is cause of the problem.
Actually MS Word preserves preferred width type while removing the first row. Also, MS Word calculates differences between previous first row properties and the new first row. And applies this difference to every row in the table to preserve previous formatting. Aspose.Words should mimic the same behavior.
In your case, the workaround would be something like this.
Document doc = new Document(MyDir + @"AsposeTest\simple.docx"); Table tbl = doc.FirstSection.Body.Tables; PreferredWidth preferredWidth = tbl.PreferredWidth; tbl.FirstRow.Remove(); // Restore previous preferred width type same Word behaves. tbl.PreferredWidth = preferredWidth; doc.Save(MyDir + @"AsposeTest\simple-18.3.docx");
so, would that keep the table from moving left?
any work around for this would be appreciated (what you sent me is width. would that fix the floating issue?)
I can save/restore table settings, if I know what to look for. in this case, the left indent is returning 0 on the table, even though it’s on the right side of the page
Thanks for your inquiry. We are investigating the issue further on our end. We will keep you posted on further updates and inform you as soon as this issue is resolved (or any estimates are available etc).
the work around for this issue is to save and restore the table’s alignment property.
At least, for those tables that have the alignment set.
apparently, not all do.
Unfortunately, your issue (WORDSNET-16595) is not resolved yet. We will inform you via this thread as soon as this issue is resolved or any further information is available. We apologize for your inconvenience.
Regarding WORDSNET-16595, please note that the table is “floating” and does not have indent specified. You can check table in source document to see that table has left indent equal to 0.
Instead of left indent table has HorizontalAlignment applied. In this case, specifying table preferred width is required to preserve table’s layout.