Formatting difference while replacing tag

Hi,
I am facing one problem while formatting file. I have two files one which defines the format and other file is input file. my application generates output file first, which is the copy of format file. Output file contains some place holder that should be replaced with values. While replacing placeholder in BODY it is showing some difference.
I have attached the files in attachment.

  1. Input.rtf // which contains all the tag with values.
  2. Output.doc // Output file which is containing extra blank line after formatting.
  3. Format.rtf // based on this file output file will be generated.

My application makes the copy of Format.rtf and saves as output file. Application does all the formatting like replacing placeholder in headers and footers etc. In output file application finds <%BODY%> placeholder and gets corresponding value from the input file which is specified between
this is body content
After getting text between the tag it replaces the <%BODY%> placeholder with processed value from input file. There is no blank line in the format.rtf file, but after saving it is showing one extra blank line before starting body content.
Application should generate the same formatted files as Format.rtf. So how do i remove extra blank line, so that after replacing placeholder it should show the same formatting like Format.rtf.
Thanks and regards
Vidhya Thawale

Hi
Thanks for your inquiry. I modified your code and now it works fine. See the following snippet.

private bool InsertContent_109592(Node paleceHolder, Node startNode, Node endNode)
{
    try
    {
        if ((startNode != null) && (endNode != null))
        {
            Node currentNode = endNode.PreviousSibling;
            m_oOutDoc = paleceHolder.Document;
            while (!currentNode.Equals(startNode) && currentNode != null)
            {
                paleceHolder.ParentNode.InsertAfter(m_oOutDoc.ImportNode(currentNode, true, ImportFormatMode.KeepSourceFormatting), paleceHolder);
                currentNode = currentNode.PreviousSibling;
            }
        }
        paleceHolder.Remove();
    }
    catch (Exception oEx)
    {
        string strError = oEx.Message;
        return false;
    }
    return true;
}

I hope this could help you.
Best regards.