While exporting a large document(approx. 40 pages) raised an error - Object reference not set to an instance of object.

2 posts, 0 answers
  1. Panch Raj
    Panch Raj avatar
    1 posts
    Member since:
    Nov 2013

    Posted 06 Jun Link to this post

    Actually current i am working on a project that needs to import /export/manage a very large word document in Rich Text Editor. 

    In this project user imports a word document of approx. 50 pages and then make some changes and the it saved to sql server database.

    Now user can load it from database and further make some changes and again saved to database.

    On importing the large word document it successfully imported in Rich Text Editor but after making some changes,

    when i export it to a file then got the error "object reference not set to an instance of object".

    Export functionality is working fine for small documents(approx 10 pages).

    I am using this code.

    Dim pathSource As String = Application.StartupPath & "\FileName.docx"
    Using fsSource As Stream = New FileStream(pathSource, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, Int32.MaxValue, True)
                            provider.Export(document, fsSource):  '(error raised after executing this line of code.)
                            Dim docByte As Byte() = New Byte(fsSource.Length - 1) {}
                            fsSource.Read(docByte, 0, System.Convert.ToInt32(fsSource.Length))
                            fsSource.Close()
                            SaveFileToDatabase(docByte)
    End Using

    Please help....

    Regards,

    Panch Raj

     

  2. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 09 Jun Link to this post

    Hi Ranch,

    Thank you for writing.

    This thread duplicates a support ticket you have also opened. Since we would need to investigate the document locally I suggest that we continue our communication there.

    Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top