InsertHTML and Carriage Return

When using the Builder.InsertHTML() function with either:-

<P align=right>testing testing ...</P> 
<DIV align=right>testing testing ...</DIV>

There is always a carriage return output to the document. I do not need this when in a table cell.
Is it possible to stop the CR being output or to delete the last character from the Builder Object?

Hi
Thanks for your request. try to use the following code.

builder.InsertCell();
builder.CellFormat.Width = builder.CurrentSection.PageSetup.PageWidth - builder.CurrentSection.PageSetup.RightMargin - builder.CurrentSection.PageSetup.LeftMargin;
builder.InsertHtml("testing testing ...");
builder.CurrentParagraph.Remove();
builder.EndRow();
builder.EndTable();

I hope that it will help you.

That worked great. thanks.
Another related question. How can you tell that you need to remove the paragraph from the builder?
eg in a simple case the HTML could be:-

"<DIV align=right>testing testing ...</DIV><b>testing 2</b>"

or

"<b>testing 2</b><DIV align=right>testing testing ...</DIV>"

In the second case I need to apply the Remove method, in the first case I don’t.

Hi
Thanks for your request. Try to use the following code to solve your problem.

builder.InsertCell();
builder.CellFormat.Width = builder.CurrentSection.PageSetup.PageWidth - builder.CurrentSection.PageSetup.RightMargin - builder.CurrentSection.PageSetup.LeftMargin;
builder.InsertHtml("<DIV align=right>testing testing ...</DIV><b>testing 2</b><b>testing 2</b><DIV align=right>testing testing ...</DIV>");
Cell cell = (Cell)builder.CurrentParagraph.ParentNode;
int parCount = cell.Paragraphs.Count;
Paragraph par = cell.FirstParagraph;
ArrayList list = new ArrayList();
for (int i = 1; i < parCount; i++)
{
    Paragraph srcPar = cell.Paragraphs[i];
    foreach (Run run in srcPar.Runs)
    {
        par.AppendChild(run);
    }
    if (srcPar.Range.Text == "\r")
    {
        list.Add(srcPar);
    }
}
foreach (Paragraph parToRemove in list)
{
    parToRemove.Remove();
}
builder.CurrentParagraph.Remove();
builder.EndRow();
builder.EndTable();

I hope that it will help you.