Error while trying to load docx with images in .tif format

Hi, i am trying to preview a .docx document using SfRichTextBoxAdv component in WPF. The thing is that the .tif images that are inside are not being displayed.


im getting this exception: 

'System.NullReferenceException' in Syncfusion.SfRichTextBoxAdv.WPF.dll

 in this line::

this.richTextBoxAdv?.Load(stream, formatType);


im pretty sure it is because of the tif images because the rest of documents are showing fine.

Is there a way to load the document without needing to export the images to pdf?


Thanks.



14 Replies 1 reply marked as answer

KG Kalaivannan Ganesan Syncfusion Team September 13, 2024 09:38 AM UTC

Jose, we have tried loading the document with TIFF format images, and it loaded properly without throwing any exceptions. The TIFF format images were also preserved correctly. We have attached a sample application where we tested this. Please check the application for more details.

Can you please try our sample application at your end. If you are still facing the issue means, we suspect that the issue might be due to the input document and specific tiff format image. So, kindly share the input Document to reproduce the reported issue. 

Note: If you have any confidential data in your input Word document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face. So, once investigated the issue, we will delete the document permanently from our side and do not share with anyone.

If you are doing some other process in the code, please modify the sample attached and share it as issue reproducible sample. Thereby, we will proceed further to replicate the same problem at our end and will provide the more details at the earliest.


Attachment: SfRichTextBoxAdv_Tif_Image_2cad62bb.zip


JA Jose Antonio Cubí September 23, 2024 11:40 AM UTC

Kalaivannan, I honestly have no idea what the issue is. I've modified the sample code you shared with me so it simulates the problem I am having in my project.

Basically when I load the "problematicDoc.rtf" and then after that load any other document (for example the "nonProblematicDoc.rtf") I get a nullReferenceException in the load method.


Both files are attached as well as the sample code.

Thanks again.


Attachment: SfRichTextBoxAdv_Tif_Image_c4e06d03.zip


KG Kalaivannan Ganesan Syncfusion Team September 24, 2024 05:59 AM UTC

Jose, we can reproduce the reported issue where a "NullReferenceException is thrown when loading the RTF document for the second time" and suspect this to be a bug. We will validate the issue and provide you with complete details by 26th September 2024.



KG Kalaivannan Ganesan Syncfusion Team September 26, 2024 05:19 AM UTC

Jose, we have confirmed the reported issue with “Exception thrown when loading a document into SfRichTextBoxAdv with an existing document containing a floating element in the footer” and logged the bug report in the SfRichTextBoxAdv control. The fix for this issue will be included in the upcoming essential studio weekly NuGet release which is estimated to be available on or before 15th October 2024.

Please use the below feedback link to track the status of the reported issue
Exception thrown when loading a document into SfRichTextBoxAdv with an existing document containing a floating element in the footer

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.



KG Kalaivannan Ganesan Syncfusion Team October 8, 2024 11:29 AM UTC

Jose, as promised earlier, we have included the fix for the reported bug with “Exception thrown when loading a document into SfRichTextBoxAdv with an existing document containing a floating element in the footer in our latest weekly NuGet release (v27.1.52).

Root cause of the issue:
The SfRichTextBoxAdv is loaded with a document containing a floating element (an image with the "in front of text" wrap format) in the footer. When a new document is loaded, the previous one is disposed of, and the new document is processed.

During the header and footer disposal, blocks such as paragraphs and their associated widgets are first disposed, followed by the header and footer widgets. When disposing the line widgets of the header, the floating elements of paragraph widgets are also disposed. However, accessing the owner paragraph and its widget during this process results in a `NullReferenceException` since the paragraph widget was already disposed of and is now null.

Please use the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.SfRichTextBoxAdv.WPF/27.1.52

The status of this bug task can be tracked through the below link:
Exception thrown when loading a document into SfRichTextBoxAdv with an existing document
containing a floating element in the footer


Marked as answer

JA Jose Antonio Cubí replied to Kalaivannan Ganesan October 8, 2024 02:34 PM UTC

Great! Thank you!



JA Jose Antonio Cubí October 8, 2024 03:59 PM UTC

Kalaivannan, I've been testing the new Nugget release and I've found a new problematic document. Im getting a nullReferenceException when loading a document into SfRichTextBoxAdv with an existing document. I am attaching you my testing project with a few documents for you to test it out.



Thanks again, Jose Antonio.


Attachment: SfRichTextBoxAdv_Tif_Image_ab2bf025.zip


KG Kalaivannan Ganesan Syncfusion Team October 9, 2024 09:53 AM UTC

Jose, we can reproduce the reported issue where a “NullReferenceException is thrown when loading a document into SfRichTextBoxAdv that already contains a document”, and we suspect this to be a bug. We will validate this issue and provide you with complete details by 11th October 2024.



KG Kalaivannan Ganesan Syncfusion Team October 11, 2024 01:13 PM UTC

Jose, we have confirmed the reported issue with “Exception thrown when loading a document into SfRichTextBoxAdv with an existing document containing a shape in the Header” and logged the bug report in the SfRichTextBoxAdv control. The fix for this issue will be included in the upcoming essential studio weekly NuGet release which is estimated to be available on or before 22nd October 2024.

Please use the below feedback link to track the status of the reported issue
Exception thrown when loading a document into SfRichTextBoxAdv with an existing document containing a shapes in the Header


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.



KG Kalaivannan Ganesan Syncfusion Team October 22, 2024 07:40 AM UTC

Jose, as promised earlier, we have included the fix for the reported bug with “Exception thrown when loading a document into SfRichTextBoxAdv with an existing document containing a shape in the Header in our latest weekly NuGet release (v27.1.55).

Root cause of the issue:
The SfRichTextBoxAdv is loaded with a document containing a floating element (shape) in the Header. When a new document is loaded, the previous one is disposed of, and the new document is processed.

During the header and footer disposal, blocks such as paragraphs and their associated widgets are first disposed, followed by the header and footer widgets. When disposing the line widgets of the header, the floating elements of paragraph widgets are also disposed. However, accessing the owner paragraph and its widget during this process results in a `NullReferenceException` since the paragraph widget was already disposed of and is now null.

Please use the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.SfRichTextBoxAdv.WPF/27.1.55

The status of this bug task can be tracked through the below link:
Exception thrown when loading a document into SfRichTextBoxAdv with an existing document containing a shape in the Header



JA Jose Antonio Cubí October 23, 2024 09:28 AM UTC

Kalaivannan, again, I have tested the last NuGet release and some problems have dissapeared but there are still a few left:


When I try to load any of the "problematicDocs" I have attached to this message I get a System.Argument.OutOfRangeException (I dont know if the problem is the same for all 3 documents).


I am attaching you my testing project with the 3 documents for you to test it out.



Thanks again, Jose Antonio.


Attachment: SfRichTextBoxAdv_Tif_Image_887642cb.rar


KG Kalaivannan Ganesan Syncfusion Team October 24, 2024 09:25 AM UTC

Jose, we attempted to reproduce the reported issue, “Exception thrown on loading the documents into SfRichTextBoxAdv,” in version 27.1.55 of SfRichTextBoxAdv. The issue was not reproduced. All three documents were loaded successfully without any exceptions.

The document named “~$0_00002” appears to be corrupted, but it was also loaded without throwing an exception.

We have attached the video illustration and the sample application we used for testing.


We suspect that you may have shared the wrong documents instead of the ones where the issue is reproducible. Could you please try the shared sample on your end again? If the issue persists, we suspect it might be due to a different input Word document. Kindly provide the correct Word document that triggered the exception so we can reproduce the reported issue.

Note: If your input Word document contains confidential data, please replace it with dummy data before sharing. We only need the document to recreate the problem. Once the investigation is complete, we will permanently delete the document from our side and will not share it with anyone.


Attachment: SfRichTextBoxAdv_v27.1.55_4a61a5a8.zip


JA Jose Antonio Cubí October 24, 2024 01:53 PM UTC

You are right, i shared the wrong documents, sorry about that. I'm sending you the correct ones.


I apologise for the inconvenience and thank you again.


Attachment: probDocs_a5fcf256.rar


KG Kalaivannan Ganesan Syncfusion Team October 25, 2024 06:19 AM UTC

Jose, we have created a separate forum for the latest reported issue to allow for better follow-up. Please use the forum link below for further assistance with the newly reported issue.

Forum :  Branched from~ 194403~Exception thrown on loading the documents into SfRichTextBoxAdv | WPF Forums | Syncfusion


Loader.
Up arrow icon