Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Dec 20, 2022 7:14 am

Hi,

I have a template in DOCX format where we have formfields in the template. We have a value that has carriage returns in it and values are mapped to form fields. So while saving the file in Docx format getting the below error.

Note - Same functionality works for PDF and DOC

System.NullReferenceException: Object reference not set to an instance of an object.
at spr?.?(TextRange A_0)
at spr?.?(TextRange A_0)
at spr?.?(FieldMark A_0, Field A_1)
at spr?.?(FieldMark A_0)
at Spire.Doc.Fields.FieldMark.Accept(spr? visitor)
at Spire.Doc.DocumentObject.?(spr? A_0)
at Spire.Doc.DocumentObject.?(spr? A_0)
at Spire.Doc.Documents.Paragraph.Accept(spr? visitor)
at Spire.Doc.DocumentObject.?(spr? A_0)
at Spire.Doc.DocumentObject.?(spr? A_0)
at Spire.Doc.Body.Accept(spr? visitor)
at spr?.?(Document A_0)
at spr?.?()
at spr?.?()
at spr?.?()
at spr?.?()
at spr?.?(spr? A_0)
at spr?.?(Document A_0, Stream A_1)
at Spire.Doc.Document.?(Stream A_0)
at Spire.Doc.Document.SaveToFile(Stream stream, FileFormat fileFormat)
at Spire.Doc.Document.SaveToStream(Stream stream, FileFormat fileFormat)
at VShips.Framework.Crew.ViewModel.Start.Contract.CrewContractViewModel.<DownloadReport>d__227.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at VShips.Framework.Crew.ViewModel.Start.Contract.CrewContractViewModel.<PrintContract>d__192.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Nirav_1992
 
Posts: 3
Joined: Sat Dec 17, 2022 7:10 am

Tue Dec 20, 2022 9:52 am

Hi,

Thank you for your inquiry.
I reproduced your issue and logged it into our bug tracking system with the ticket number SPIREDOC-8904. Our development team will investigate and fix it. Once it is solved, I will inform you in time. Sorry for the inconvenience caused.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Tue Jan 31, 2023 7:45 am

Hi,

Any Updates?

Please can we have a quick solution or workaround to fix it?

Nirav_1992
 
Posts: 3
Joined: Sat Dec 17, 2022 7:10 am

Tue Jan 31, 2023 9:07 am

Hi,

Thank you for your following up.
Our dev team has adjusted the SPIREDOC-8904 and it has entered the testing stage. Once it passes the test, we will inform you ASAP. Thanks for your patience.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Fri Mar 10, 2023 5:29 am

Hi,

Thanks for your patience!
Glad to inform you that we just released Spire.Doc 11.3.1 which fixes the issue with SPIREDOC-8904.
Please download the new version from the following links to test.
Website download link: https://www.e-iceblue.com/Download/download-word-for-net-now.html
Nuget download link: https://www.nuget.org/packages/Spire.Doc/11.3.1

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Wed Apr 12, 2023 10:02 am

Hi,

Thanks for the update.
We have tried with both versions -Spire.Doc 11.3.1 & 11.4.0, but still, the issue persists.

I am sharing the sample project where this issue is getting replicated.
Can you please check with a sample project attached to the post?

Nirav_1992
 
Posts: 3
Joined: Sat Dec 17, 2022 7:10 am

Thu Apr 13, 2023 9:05 am

Hi,

Thank you for your feedback.
Sorry, as you did not provide any document or code earlier, we only made the compatibility for a single '\r'. I have re-logged your issue with ticket number SPIREDOC-9283. Additionally, I have tried saving in the doc format and found that line breaks'\r\n' are displayed as garbled characters. Would it be acceptable for us to make docx compatible in the same way? If not, please provide the desired output effect, which I will submit to our development team for investigation on whether it can be achieved. Sorry for the inconvenience caused.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.Doc

cron