Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

mail merge with regions - deleting empty paragraphs

Last post 01-19-2011, 6:44 AM by alexey.noskov. 2 replies.
Sort Posts: Previous Next
  •  07-29-2010, 6:39 PM 251198

    mail merge with regions - deleting empty paragraphs .NET

    Attachment: Present (inaccessible)
    Hi

    There have been a few posts on this subject.  I downloaded the file RemoveEmptyRegions.zip as per previous instructions (eg http://www.aspose.com/community/forums/thread/247750/remove-empty-tables-v9.1.0.0.aspx) and initially it didn't work.

    I modified it and have attached the modified version in case you do include support for this requirement in a future release (just to make sure we are covered).  My fix worked in my case, but the algorithm used in the class is quite complex and I'm sure you will find a better way to achieve the same result.  I have added one line (line 136).

    In our case, we are using a table for layout, and nested inside the table on different rows are several regions that display optional data.  The region itself does not use a table, the tablestart and tableend mergefields are at the start end of the same paragraph (with bullet point formatting).

    We want the paragraph to disappear when there is no data matching the table name.  Using the unmodified version, we ended up with a blank line with a bullet point.  The paragraph was not deleted.

    I think the algorithm was confused in our case because the region is always in a table, it is just not a table used directly for building the region.  We would not expect any rows to be deleted because the region is empty.  My extra line forces the algorithm to check if the paragraph can be deleted while it is processing the cells in the table.

    Are we out on a limb, have we done something that is not supported?  Is there a better way to achieve our objective?

    Thanks

    David


     
  •  07-30-2010, 8:24 AM 251321 in reply to 251198

    Re: mail merge with regions - deleting empty paragraphs

    Hi David,

    Thanks for your inquiry. The line of code that you added to remove the empty bullet point appears to work as you want so that's fine.

    Could you please attach your template here for testing and an example document of how you want it to look after removing the regions so I can get a better understanding your situation?

    I believe the code doesn't remove the empty paragraphs in the cell right now, becasue as you know the code was a work around and most likely the customer wanted or did not mind the paragraphs being left as they were in that situation.

    What your asking though is understandable, as one customer will want the regions removed differently from the next. For example some may want the paragraph where a empty region is removed to be completely removed all of the time, while some may want it to be only removed if the paragraph becomes empty, and some may never want it to be removed regardless.

    I will look into adding a few parameters to cater for these sorts of requirements and reattach an updated version some time soon. Please note that we have also linked your request to the appropriate issue and we will notify you when this feature becomes fully supported. For now I believe utilizing this class is the best way to achieve your objective.

    Thanks,


    Adam Skelton
    Programming Writer
    Aspose Auckland Team
     
  •  01-19-2011, 6:44 AM 279569 in reply to 251321

    Re: mail merge with regions - deleting empty paragraphs

    The issues you have found earlier (filed as 17666) have been fixed in this update.       


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
View as RSS news feed in XML