This is a migrated thread and some comments may be shown as answers.

Removing space from embedded custom mail merge table

1 Answer 36 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
band
Top achievements
Rank 1
band asked on 22 Feb 2017, 09:01 PM

Hi, I inputted a table onto my document with 1 row and 2 columns.

I then inputted a Custom Merge Field in column 2. My Custom Merge field inputs a table. Code is below

protected override DocumentFragment GetResultFragment()
{
    UniversalDTO universalDTO = this.Document.MailMergeDataSource.CurrentItem as UniversalDTO;
    if (universalDTO == null)
    {
        return null;
    }
 
    if (this.PropertyPath == "Collaterals")
    {
        Table table = new Table();
 
 
        foreach (var coillateral in universalDTO.Collaterals)
        {
            Span span = new Span(coillateral.Type.Value);
            span.FontSize = 11.5;
            Paragraph paragraph = new Paragraph();
            paragraph.Inlines.Add(span);
 
            Span span2 = new Span(coillateral.Description);
            span2.FontSize = 11.5;
            Paragraph paragraph2 = new Paragraph();
            paragraph2.Inlines.Add(span2);
 
            TableCell cell = new TableCell();
            cell.Blocks.Add(paragraph);
            cell.Borders = new TableCellBorders(new Border(1, BorderStyle.Single, Colors.Transparent));
 
            TableCell cell2 = new TableCell();
            cell2.Blocks.Add(paragraph2);
            cell2.Borders = new TableCellBorders(new Border(1, BorderStyle.Single, Colors.Transparent));
 
            TableRow row = new TableRow();
            row.Cells.Add(cell);
            row.Cells.Add(cell2);
            table.AddRow(row);
        }
 
        Section section = new Section();
        section.Blocks.Add(table);
 
        RadDocument document = new RadDocument();
        document.Sections.Add(section);
 
        document.MeasureAndArrangeInDefaultSize();
        return new DocumentFragment(document);
    }
 
    return null;
}

 

The issue I'm having is depicted by the image below, there's a space ontop of the nested table. If tried to delete in the document, it deletes the table. That empty line can be deleted in word though.

http://imgur.com/cf22ee44-9cdd-4840-b045-a9500c8d0569

 

Code View 

 

http://imgur.com/LQirves

1 Answer, 1 is accepted

Sort by
0
band
Top achievements
Rank 1
answered on 22 Feb 2017, 09:02 PM
Issue is shown in this image

http://imgur.com/H5xExd1

Sorry but I can't edit my previous post. 
Tags
RichTextBox
Asked by
band
Top achievements
Rank 1
Answers by
band
Top achievements
Rank 1
Share this question
or