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.

Wed Jan 07, 2015 10:10 pm

I have a docx file that has within it another document embedded using altChunk
I am able to open that document, but I then need to save it as an rtf file
when I do, It gets a null reference exception somewhere within the save

saperstb
 
Posts: 2
Joined: Wed Jan 07, 2015 9:05 pm

Thu Jan 08, 2015 1:56 am

Hello,

Thanks for your inquiry.

To help us reproduce this problem, please upload your sample document and code snippet to the forum or send them to burning.liu@e-iceblue.com.

Thank you.

Note: Please zip them before uploading.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Thu Jan 08, 2015 6:31 pm

var document = new Document();
document.LoadFromFile(@"C:\temp\sample\AltChunkSample.docx");

// Save doc file.
document.SaveToFile("AltChunkSample.rtf", FileFormat.Rtf);

System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Spire.Doc
StackTrace:
at spr⁨.ᜀ(spr᷎ A_0)
at spr⁨.ᜀ(ParagraphBase A_0)
at spr⁨.ᜂ(Paragraph A_0)
at spr⁨.ᜀ(BodyRegionCollection A_0)
at spr⁨.ᜁ(Section A_0)
at spr⁨.ᜍ()
at spr⁨.ᜀ(StreamWriter A_0, IDocument A_1)
at spr⁨.ᜀ(String A_0, IDocument A_1)
at Spire.Doc.Document.ᜄ(String A_0)
at Spire.Doc.Document.SaveToFile(String fileName, FileFormat fileFormat)
at ConvertToRtf.Form1.button1_Click(Object sender, EventArgs e) in c:\Dev\stuff\e-iceblue\Spire.Doc\Demos\CS\WinForms\05_Convertors\ToRtf\Form1.cs:line 69
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
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 ConvertToRtf.Program.Main() in c:\Dev\stuff\e-iceblue\Spire.Doc\Demos\CS\WinForms\05_Convertors\ToRtf\Program.cs:line 17
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:

saperstb
 
Posts: 2
Joined: Wed Jan 07, 2015 9:05 pm

Fri Jan 09, 2015 1:52 am

Hello,

Thanks for sharing your code snippet and document.

I have reproduced this problem and posted it to our dev team, we will inform you if there is any update about this issue.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Return to Spire.Doc