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 Jan 09, 2018 9:05 pm

I wrote my code using the evaluation version of Spire.Doc, using the latest version available with NuGet, which was 6.0.91. After working with it, I saw the evaluation stamp at the top of my documents. In order to remove this without manual editing, I decided to instead use the Free version (5.7.0), until we're happy with the product, and are committed to this path forward with our app.

However, without any changes to my code, other than the references, which are handled by NuGet, the load now fails. The versions should be the same, I would think, other than the stamp at the top and the restrictions placed on the two versions. With regard to basic functionality, they should be identical. The two versions are inconsistent, and that greatly concerns me, from an evaluation perspective.

Here is my code:

Code: Select all
            Document thisdoc = new Document();
            thisdoc.LoadFromFile(TemplateFileName);


The TemplateFileName variable comes into the method as a string, but originally comes from a document that is loaded into memory from the database in the calling method.

I originally had this in a using statement:

Code: Select all
            using (Spire.Doc.Document thisdoc = new Document(TemplateFileName.ToString()))


In that case, the TemplateFileName came in as an object, thus the ToString() usage.

In both cases, I verified that the value of TemplateFileName is:
"C:\\Projects\\AirTools\\trunk\\AirTools\\AirToolsWin\\bin\\x86\\Debug\\ACC Acceptance Letter Template__743667__857338.DOCX"


When I attempt to run the routine, it throws the NullReferenceException, attached below, using either format. However, if I return to the Spire.Doc version, it works as it should. This only happens in FreeSpire.Doc

Here is the error detail:

System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Spire.Doc
StackTrace:
at spr1503.14(XmlReader A_0, ParagraphItemCollection A_1)
at spr1503.14(XmlReader A_0, IDocumentObject A_1)
at spr1503.13(Stream A_0)
at spr1503.1(spr395 A_0)
at spr1503.1(Document A_0)
at spr1503.1(Stream A_0, Document A_1)
at spr1503.0(String A_0, Document A_1)
at Spire.Doc.Document.16(String A_0)
at Spire.Doc.Document.LoadFromFile(String fileName, FileFormat fileFormat, String password)
at Spire.Doc.Document.0(String A_0, String A_1)
at Spire.Doc.Document.LoadFromFile(String fileName)
at AirToolsWin.Globals.CreateDocFromTemplate(String TemplateFileName, Dictionary`2 repList) in C:\Projects\AirTools\trunk\AirTools\AirToolsWin\Globals.cs:line 909
at AirToolsWin.Globals.GenerateLetter(String category, String type_code, clsAttach ca, DataSet ds) in C:\Projects\AirTools\trunk\AirTools\AirToolsWin\Globals.cs:line 852
at AirToolsWin.frmSubmittedReport.miPrintLetter_ItemClick(Object sender, EventArgs e) in C:\Projects\AirTools\trunk\AirTools\AirToolsWin\frmSubmittedReport.cs:line 835
at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarButtonItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarItemLink.OnLinkClick()
at DevExpress.XtraBars.BarButtonItemLink.OnLinkClick()
at DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
at DevExpress.XtraBars.Controls.CustomLinksControl.OnMouseUp(MouseEventArgs e)
at DevExpress.XtraBars.Controls.CustomPopupBarControl.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.XtraBars.Controls.CustomControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at AirToolsWin.frmMain.Main(String[] args) in C:\Projects\AirTools\trunk\AirTools\AirToolsWin\frmMain.cs:line 60
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:


Any assistance with this issue would be appreciated.

John

johnbrook19
 
Posts: 2
Joined: Mon Jan 08, 2018 10:14 pm

Wed Jan 10, 2018 2:15 am

Hello John,

Thanks for your post.
So sorry for the inconvenience that our Free version caused. Since we have no plan to update the free version and all the fixes and new features are implemented in the commercial version, I recommend you turning to the commercial version. In addition, we have sent a 1-month free license of Spire.Doc to you via email for helping remove the warning message so that you can have a better evaluation of our products. Please refer to the guidance on how to apply the license.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Jan 10, 2018 3:48 pm

Thank you for providing the license, and I'll see if this product will work. However, the process for us will likely take more than a month, so this might not provide us what we're looking for. Thank you.

Cordially,
John

johnbrook19
 
Posts: 2
Joined: Mon Jan 08, 2018 10:14 pm

Thu Jan 11, 2018 1:39 am

Hi John,

Thank you for responding.
Just come back to me if you need any assistance.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Doc