We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Removing white space from tables

Hello,



I have a problem with extra white space being created in tables where I have some columns that have no data within a row.



I have played around with the cleanup options - currently using doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveEmptyParagraphs Or MailMergeCleanupOptions.RemoveUnusedRegions.



This is getting me closest to the desired result but is not perfect. This was working without issue on previous versions of dll but is not working on the current version that I have installed (14.4.0.0).



I have attached some sample data, the template and a sample output with some of the areas of concern highlighted.



I have tried using no data and a space in the empty fields to get around this issue with no success. Previously a space would fix the formatting issue.



Thanks in advance for your help.

Hi Joe,

Thanks for your inquiry.

I
have tested the scenario and have managed to reproduce the same issue
at my side. For the sake of correction, I have logged this problem in
our issue tracking system as WORDSNET-10362. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

As a workaround, please use the following code example. Hope this helps you.


Document doc = new Document(MyDir + "SampleTemplate.doc");

DataSet ds = new DataSet();

ds.ReadXml(MyDir + "dataset.xml");

doc.MailMerge.CleanupOptions |= Aspose.Words.Reporting.MailMergeCleanupOptions.RemoveEmptyParagraphs;

doc.MailMerge.ExecuteWithRegions(ds);

foreach (Cell cell in doc.GetChildNodes(NodeType.Cell, true))

{

if (!cell.HasChildNodes)

{

cell.EnsureMinimum();

cell.FirstParagraph.ParagraphFormat.SpaceAfter = 0;

cell.FirstParagraph.ParagraphFormat.SpaceBefore = 0;

}

}

doc.Save(MyDir + "Out.docx");

Hello Tahir,

Thank you for your reply.

I have not had a chance to test this out yet but I will soon.

I did manage to workaround this problem by injecting a unique character string where the spaces were and then performing a replace (removing this character string) after the ExecuteWithRegions.

Your solution looks much better than mine but it did get me out of trouble for now!

Thanks again,
Joe

Hi Joe,

Thanks for your feedback. It is nice to hear from you that you have workaround of this issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Tahir,

Can you confirm if this bug exists in v13.6? I believe I’m seeing the exact same behavior if a merge field is whitespace (spaces, null, etc).

Thanks!

Hi Joe,

Thanks for your inquiry. Yes, this issue exists in v13.6.0. See the attached output document for your kind reference.

We have a good news for you that is WORDSNET-10362 has now been resolved and its fix will be included in the next version of Aspose.Words (v14.7.0) which is planned to be released by the end of this month (around July’ 31, 2014). We will inform you via this forum thread as soon as July 2014 release is published.

Tahir, I’m not seeing any attachment.

Also, is there any way we can get this fix ported to 13.6 fix? Going back and re-testing all of our output for changes introduced between 13.6 and now just isn’t an option right now.

Thanks for the update,
Eric

Hi Eric,

Please accept my apologies for your inconvenience. I have attached the output document with this post.

Please note that we do not provide any fixes or patches for old versions
of Aspose products either. All fixes and new features are always added
into new versions of our products. So, you will have to upgrade if you
need new features or fixes.

The issues you have found earlier (filed as WORDSNET-10362) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.