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:
Thanks you
Robin