After append cover page will throw exception

a document after adding a cover page, when saving document aspose will throw exception.

my test code: (excute this function twice will always throw exception)

private void btnAddCover_Click(object sender, EventArgs e)
{
    string builtinBuildingblock = @"C:\Users\CHN\AppData\Roaming\Microsoft\Document Building Blocks\1033\15\Built-In Building Blocks.dotx";
    string docFile = @"C:\Users\CHN\Desktop\testDoc\Test.Docx";
    ADoc.Document docx = new ADoc.Document(docFile);
    new DocumentNormalizer(docx).Normalize();
    ADoc.Document docBuildingBlocks = new ADoc.Document(builtinBuildingblock);
    CreateCover(docx, docBuildingBlocks, "Semaphore");
    docx.Save(docFile, SaveFormat.Docx);
}

DocumentNormalizer class just delete some unnecessary document node.

please use attechment to test. the attachment include the some part of sourcecode.

thanks.

only some of cover page will throw this exception, “Semaphore” is one of them.

Hi Pyntia,

Thanks for your inquiry. Unfortunately, at the moment, we’re not able to reproduce this issue on our end because some bits of code are missing from your shared code (CreateCover function definition is missing). We suggest you please create a standalone runnable simple console application that helps us reproduce the same exception on our end and attach it here for testing. As soon as you get this application ready, we’ll investigate the issue further and provide you more information. Thanks for your cooperation.

Best regards,

hi, Awais

thank you for your reply

i sorry for my careless, below is lost function:

private void CreateCover(ADoc.Document docx, ADoc.Document docBuildingBlocks, string coverName)
{
    ADoc.BuildingBlocks.GlossaryDocument glossaryDocument = docBuildingBlocks.GlossaryDocument;
    foreach (ADoc.BuildingBlocks.BuildingBlock buildingBlock in glossaryDocument.BuildingBlocks)
    {
        if (buildingBlock.Gallery.ToString().StartsWith("CoverPage"))
        {
            if (buildingBlock.Name == coverName)
            {
                // clone section which you want to keep layout of
                ADoc.Section sec = docx.FirstSection.Clone();
                // remove existing content of this section
                sec.RemoveAllChildren();
                // append content of buildingBlock to this section
                foreach (ADoc.Node node in ((ADoc.Section)buildingBlock.FirstChild).ChildNodes)
                    sec.AppendChild(docx.ImportNode(node, true));
                docx.InsertBefore(sec, docx.FirstChild);
                break;
            }
        }
    }
}

Hi Pyntia,

Thanks for your inquiry. When using Aspose.Words for .NET 14.2.0 and your code, I was unable to reproduce this issue on my side. I have generated an output .docx here for your reference (see attached out.docx). I suggest you please upgrade to the latest version from the following link:

https://downloads.aspose.com/words/net

I hope, this helps.

Best regards,

hi, Awais

i have been created a test project for reproduce the scenario,please see attachment for further testing.

the attachment contains two document, one is normal test document, another is a word2013 built-in template file.

please modify the test code to use these two document.

thanks

i’m already in use 14.2

Hi Pyntia,

While using the previous version of Aspose.Words i.e. 14.2.0, I managed to reproduce “System.ArgumentException” on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-9962.

I also tested your scenario with latest version of Aspose.Words 14.3.0 but unfortunately it threw “Aspose.Words.FileCorruptedException” during loading “Built-In Building Blocks.dotx” document into its DOM. This issue has also been logged as WORDSNET-9960.

Your request has also been linked to these issues and you will be notified as soon as they are resolved. Sorry for the inconvenience.

Best regards,

hi, Awais

i found a another question about cover page interaction.

if you use the test project to insert cover which named “Austin”, the result cover page will be rendering mistake obviously.

the correct render picture in word

additional information:

cover named “Slice (Dark)” also have this problem.

so many bugs in cover page.

i have update the test project to show another new issue.

in this project, if adding cover named “Semaphore”,“Whisp”,“Motion”,“Filigree” will always throw exception.

the interesting things is: this time the test document is very very simple which include in attechment with name “Custom Cover Page.docx”

please use attechment for further testing.

still in use 14.2

Hi Pyntia,

Thanks for your inquiry.

Pyntia:

i found a another question about cover page interaction.

if you use the test project to insert cover which named “Austin”, the result cover page will be rendering mistake obviously.

I have logged this problem in our issue tracking system as WORDSNET-10069. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Hi Pyntia,

Thanks for your inquiry.

Pyntia:

additional information:

cover named “Slice (Dark)” also have this problem.

so many bugs in cover page.

I have logged this problem in our issue tracking system as WORDSNET-10070. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Hi Pyntia,

Pyntia:

i have update the test project to show another new issue.

in this project, if adding cover named “Semaphore”,“Whisp”,“Motion”,“Filigree” will always throw exception.

the interesting things is: this time the test document is very very simple which include in attechment with name “Custom Cover Page.docx”

please use attechment for further testing.

still in use 14.2

I have logged this problem in our issue tracking system as WORDSNET-10071. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

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


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

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


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

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


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

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


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

i have verified the “Slice (Dark)” error, i found the error still existing.

the left cover is insert by word, the right cover is insert by aspose. it is diff obvious.

can you please checking again for this bug?