See attached sample: it creates a word table whose columns all have a percentage width. The table has a preferred width of “100%”. TableWidthValidator.zip (5.4 KB)
After adding a “IWarningCallback” to our project, this results in this warning:
WarningType = “MinorFormattingLoss”
Source = “Validator”
Description = “Table width exceed maximum allowed, table was resized.”
The sum of the column percentage widths is exactly “100%”, but the warning also happens if I reduce the width of one column.
Do you have an idea? Is there something wrong in my code (which is quite ugly - it is printed by our aspose table wrapper when adding the table to a document)?
The warning you are encountering, “Table width exceed maximum allowed, table was resized,” typically occurs when the total width of the columns in a table exceeds the maximum allowable width for the table itself. Even if the sum of the column percentage widths is exactly 100%, other factors can influence the final rendered width of the table.
Here are a few suggestions to troubleshoot and potentially resolve this issue:
Check Table Properties: Ensure that the table’s preferred width is set correctly. If the table’s preferred width is set to 100%, it should ideally match the total width of the columns. However, if there are additional paddings or margins applied, it could lead to exceeding the maximum width.
Column Widths: Review the individual column widths. If you have set specific widths for any columns, ensure that they do not conflict with the percentage widths. Sometimes, a combination of fixed and percentage widths can lead to unexpected results.
Cell Padding and Spacing: Check the padding and spacing settings for the cells. Excessive padding or spacing can add to the overall width of the table, causing it to exceed the maximum allowed width.
IWarningCallback Implementation: Since you are using an IWarningCallback, consider logging the details of the warning to get more insights into which specific property or setting is causing the issue. This can help you identify if it’s a specific column or a general table setting.
Testing with Simplified Table: As a debugging step, try creating a simplified version of your table with fewer columns or without percentage widths to see if the warning persists. This can help isolate the issue.
If you continue to face challenges, please share a snippet of your code that constructs the table, as it may provide further context for diagnosing the problem.
For more detailed examples and best practices regarding table creation and formatting, you can refer to the Aspose documentation and code examples available in their GitHub repository.
If you have any further questions or need additional assistance, feel free to ask!
Ignoring it is not so easy, as I have a reporting framework that generates a bunch of word documents, and I register the IWarningCallback globally for the entire framework. So I cannot suppress it for a special document, I can just suppress the “Table width exceed maximum allowed” message for all documents. But it might be reasonable (and fixable) under some circumstances.
Is it a problem in Aspose.Words that will be fixed in the future? If yes I don’t have a bad feeling to ignore the message temporarely .
@wknauf After analysis, most likely the code that generates this warning will be revised or removed. The code of this method looks obsolete and unlikely to produce anything similar to MS Word table layout, especially the part that tries to resize nested tables to container width.
@wknauf Actually, we detected that the code that shows this warning is obsolete while analyzing the issue you have reported in your another thread. So you can track this issue.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.