Dear Support
On merging specific documents with docIO I get a nullReference exception inside docIo assembly.
It occurs only if I merge the files, which are attached to the post. So it must have something to do with the content of the documents.
With this exception is hard to give the user a feedback, what is wrong with their documents. But actually think this is a bug and should not happen.
This is the code I am using to merge:
public GenericResponse<string> Compose(List<string> sourceFilePaths, string savePath)
{
try
{
var destinationDoc = new WordDocument();
foreach (var sourceFilePath in sourceFilePaths)
{
var sourceDoc = new WordDocument(sourceFilePath);
sourceDoc.Sections[0].BreakCode = SectionBreakCode.NoBreak;
destinationDoc.ImportContent(sourceDoc, ImportOptions.UseDestinationStyles);
sourceDoc.Close();
}
destinationDoc.Save(savePath);
destinationDoc.Close();
return GenericResponse<string>.CreateSuccessResponse(savePath, "Documents successfully merged.");
}
catch (Exception e)
{
return GenericResponse<string>.CreateErrorResponse("Error while merging the documents.",
"", e);
}
}
Her is the stack Trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.OfficeChart.Implementation.NameImpl.get_Columns()
at Syncfusion.OfficeChart.Implementation.Charts.ChartSerieImpl.set_CategoryLabelsIRange(IRange value)
at Syncfusion.OfficeChart.Implementation.Charts.ChartSerieImpl.Clone(Object parent, Dictionary`2 hashNewNames, Dictionary`2 dicFontIndexes)
at Syncfusion.OfficeChart.Implementation.Charts.ChartSeriesCollection.Clone(Object parent, Dictionary`2 hashNewNames, Dictionary`2 dicFontIndexes)
at Syncfusion.OfficeChart.Implementation.Charts.ChartImpl.Clone(Dictionary`2 hashNewNames, Object parent, Dictionary`2 dicFontIndexes)
at Syncfusion.OfficeChart.Implementation.Charts.ChartImpl.Clone(Object parent)
at Syncfusion.OfficeChart.Implementation.Charts.ChartImpl.Clone()
at Syncfusion.DocIO.DLS.WChart.CloneImpl()
at Syncfusion.DocIO.DLS.Entity.Clone()
at Syncfusion.DocIO.DLS.ParagraphItemCollection.CloneItemsTo(ParagraphItemCollection items)
at Syncfusion.DocIO.DLS.WParagraph.CloneParagraph(Boolean cloneItems)
at Syncfusion.DocIO.DLS.WParagraph.CloneImpl()
at Syncfusion.DocIO.DLS.Entity.Clone()
at Syncfusion.DocIO.DLS.EntityCollection.CloneTo(EntityCollection destColl)
at Syncfusion.DocIO.DLS.WTextBody.CloneImpl()
at Syncfusion.DocIO.DLS.Entity.Clone()
at Syncfusion.DocIO.DLS.WSection.CloneImpl()
at Syncfusion.DocIO.DLS.Entity.Clone()
at Syncfusion.DocIO.DLS.EntityCollection.CloneTo(EntityCollection destColl)
at Syncfusion.DocIO.DLS.WordDocument.ImportContent(IWordDocument doc, ImportOptions importOptions)
at xxx.xxx.DocumentManager.DocumentComposer.Compose(List`1 sourceFilePaths, String savePath) in D:\xxx\Operativ\BusinessApps\xxx\xxx.xxx\DocumentManager\xxx.cs:line 22
Hi Patrick,
We have reproduced the reported issue with "NullReferenceException
throws while importing content from one Word document to another"
in our end, and we suspect it to be a defect. We will validate this issue
and update you with more details on or before 25th May 2022.
Regards,
Anto Nihil S
Hi Patrick,
We have confirmed that the reported issue
with “NullReferenceException
throws while importing content from one Word document to another” is
a defect and we have logged a defect report. We will include the fix for this defect in our
weekly NuGet release which is estimated to be available on 31st May 2022.
The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/34963/exception-is-thrown-while-importing-content-from-one-word-document-to-another
Disclaimer: “Inclusion of this solution in the weekly release may change
due to other factors including but not limited to QA checks and works
reprioritization.”
Note: If you require a patch for the reported issue in any of our
Essential Studio versions (except weekly release version), then kindly let us
know the currently installed version, so that we can provide a patch in that
version based on our SLA policy.
Regards,
Anto Nihil S
Hi Patrick,
As promised
earlier, we have included the fix for the reported issue with “NullReferenceException
throws while importing content from one Word document to another” in our
latest weekly NuGet release (v20.1.0.58).
Please use
the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.DocIO.Wpf/20.1.0.58
The status
of this bug task can be tracked through the below link:
https://www.syncfusion.com/feedback/34963/exception-is-thrown-while-importing-content-from-one-word-document-to-another
Note: We will include
this fix in our 2022 Volume 2 main release which will be available in end of
June 2022.
Regards,
Suriya Balamurugan.