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.

Thu Feb 25, 2016 3:45 pm

Hi,

I'm trying to get rid of vertical tabs in my document, but I'm getting a nullref exception:

When the document contains a few vertical tabs (\v or shift-enter in Word), any of the following lines fail:

Code: Select all
document.Replace("\v", "test", false, false);
document.Replace("\v", "\r\n", false, false);
document.Replace("\v", string.Empty, false, false);
document.Replace(new Regex("\v"), string.Empty);


System.NullReferenceException occurred
Message=Object reference not set to an instance of an object.
Source=Spire.Doc
StackTrace:
at spr1811.1(Paragraph A_0, Regex A_1, String A_2)
at Spire.Doc.Documents.Paragraph.Replace(Regex pattern, String replace)
at Spire.Doc.Body.0(Regex A_0, String A_1)
at Spire.Doc.Document.Replace(Regex pattern, String replace)
at Spire.Doc.Document.Replace(String matchString, String newValue, Boolean caseSensitive, Boolean wholeWord)
at Table.Program.Main(String[] args) in C:\Users\rvos\Desktop\Reproduce Spire Replace NullRefException\Program.cs:line 24
InnerException:


You can find the full code and the docx document here:

Reproduce Spire Replace NullRefException.zip


Thanks you
Robin

robinvos
 
Posts: 22
Joined: Thu Oct 08, 2015 8:43 am

Fri Feb 26, 2016 6:25 am

Hi Robin,

Thanks for your posting.
I have reproduced your issue and have forwarded to our dev team. We will inform you when it is resolved.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2767
Joined: Wed Jun 27, 2012 8:50 am

Fri Mar 11, 2016 6:47 am

Hello,

Thanks for your waiting. Here is a new hotfix you can donwload and have a try.
http://www.e-iceblue.com/downloads/Temp ... 2.13.2.zip
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Mar 11, 2016 1:53 pm

Hello,

The hotfix seems to have resolved this issue. Thanks.

Best regards,
Robin

robinvos
 
Posts: 22
Joined: Thu Oct 08, 2015 8:43 am

Mon Mar 14, 2016 6:15 am

Hi Robin,

Thanks for your feedback.
I am glad that your issue has been resolved.
Welcome to write to us again for further problems.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2767
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc