Line Breaking on Header Using ODT File

I’m using the following code to process the documents:

Hashtable hsTagsRegs = new Hashtable();
hsTagsRegs.Add("##DatImp", new DateTime(2011, 06, 15, 17, 05, 00));
hsTagsRegs.Add("##NmeElb", "Siteware");
hsTagsRegs.Add("##DatApr", "");
hsTagsRegs.Add("##SigUni", "SiteAir 2011");
hsTagsRegs.Add("##TitDoc", "TESTE ROGGER");
hsTagsRegs.Add("##NmeVrf", "");
hsTagsRegs.Add("##DatVrf", "");
hsTagsRegs.Add("##TipCop", "Copia Nπo Controlada");
hsTagsRegs.Add("##DatCri", new DateTime(2011, 06, 14, 11, 10, 06));
hsTagsRegs.Add("##NumRev", "0");
hsTagsRegs.Add("##NmeApr", "Siteware");
hsTagsRegs.Add("##CodDoc", "AI_Site_Air2011_009");
Workbook xls = new Workbook(pFileName);
foreach(DictionaryEntry item in htTagsRegs)
{
    for (int i = 0; i <xls.Worksheets.Count; i++)
    {
        Aspose.Cells.PageSetup pageSetup = xls.Worksheets[i].PageSetup;
        for (int j = 0; j <xls.Worksheets.Count; j++)
        {
            string header = pageSetup.GetHeader(j);
            if (header != null && header != "")
            {
                header = header.Replace(item.Key.ToString(), item.Value.ToString());
                pageSetup.SetHeader(j, header);
            }
            string footer = pageSetup.GetFooter(j);
            if (footer != null && footer != "")
            {
                footer = footer.Replace(item.Key.ToString(), item.Value.ToString());
                pageSetup.SetFooter(j, footer);
            }
        }
        xls.Worksheets[i].Replace(item.Key.ToString(), item.Value.ToString());
    }
}

But in the output file, there is a line breaking in the header. I’m attaching both input and output files.

Hello
Thanks for your inquiry. As I can see, in your code you are using Aspose.Cells. Could you please clarify your questions, and attach the code which will allow me to reproduce the problem on my side.
Best regards,

Sorry, the correct code for the for iteration is:

foreach(DictionaryEntry item In htVarConf)
{
    doc.Range.Replace(item.Key.ToString(), item.Value.ToString(), false, false);
}

Hello
Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words 10.7.0 and the following code:

Document doc = new Document("C:\\Temp\\Input.odt");
Hashtable hsTagsRegs = new Hashtable();
hsTagsRegs.Add("##DatImp", new DateTime(2011, 06, 15, 17, 05, 00));
hsTagsRegs.Add("##NmeElb", "Siteware");
hsTagsRegs.Add("##DatApr", "");
hsTagsRegs.Add("##SigUni", "SiteAir 2011");
hsTagsRegs.Add("##TitDoc", "TESTE ROGGER");
hsTagsRegs.Add("##NmeVrf", "");
hsTagsRegs.Add("##DatVrf", "");
hsTagsRegs.Add("##TipCop", "Copia Nπo Controlada");
hsTagsRegs.Add("##DatCri", new DateTime(2011, 06, 14, 11, 10, 06));
hsTagsRegs.Add("##NumRev", "0");
hsTagsRegs.Add("##NmeApr", "Siteware");
hsTagsRegs.Add("##CodDoc", "AI_Site_Air2011_009");
foreach(DictionaryEntry item in hsTagsRegs)
{
    doc.Range.Replace(item.Key.ToString(), item.Value.ToString(), false, false);
}
doc.Save("C:\\Temp\\out.odt");

I have sent the document produced on my side to your e-mail.
Best regards,

AndreyN, please, see the attached file. It is the file you sent to me. I’ve highlighted the error, compare with the Input file.

Hello
Thank you for additional information. As I can see you (or your colleagues) already reported this problem to us in this thread:
https://forum.aspose.com/t/58558
Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
Best regards,

Thank you very much.

Any updates on this issue?

Hello
Thanks for your request. This issue is pending for analysis. The responsible developer will analyze the issue and we will be able to provide you additional information.
Best regards,

Any updates on this issue?

Hi
Rogger,

Thank you for your patience. Unfortunately, this issue is still unresolved and currently is pending for analysis. Once the issue is resolved, you will be notified. Sorry for inconvenience.

Best Regards,

Any updates on this issue?v

Hi Rogger,

Thank you for your patience. Unfortunately, this issue is still unresolved. Currently it is pending for analysis and is in the queue. You will surely be notified as soon as it is resolved. We apologize for your inconvenience.

Best Regards,

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

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