Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Thu Feb 13, 2020 8:08 pm

Word Document corrupted attachment after editing.
Adjunct images code for OPENING, EDITING, AND SAVING.
Also include corrupted document.

I appreciate your help for issue.
You do not have the required permissions to view the files attached to this post.

Posts: 11
Joined: Tue Oct 28, 2014 9:41 pm

Fri Feb 14, 2020 2:55 am


Thanks for your inquiry.
The attached file "C-0004.doc" should be your input file, rather than the corrupted output file as you said, right? Because I didn't encounter any problem when opening it using Microsoft Word.

I tested your Word file with the latest Spire.Doc Pack(hot fix) Version:8.2.4 but the output file has no issues. Below is the code I used, and I also attached my output file for your reference. If you were using an old version, please try again with the latest version.
Code: Select all
        'Agrega el usuario revisor o aprobador y la fecha en el pie de página del documento
        Dim documentoCedula As New Document()
        documentoCedula.LoadFromFile("C-0004.doc", FileFormat.Doc)
        Dim seccionDelDocumento = documentoCedula.Sections(0)
        Dim piePagina = seccionDelDocumento.HeadersFooters.Footer
        Dim cantidadDeParrafos = seccionDelDocumento.HeadersFooters.Footer.Paragraphs.Count
        'Borra el revisor y aprobador del pie de página del documento
        If cantidadDeParrafos > 2 Then
            For index As Integer = cantidadDeParrafos - 1 To 2 Step -1
        End If
        Dim parrafo As Paragraph = piePagina.AddParagraph()
        Dim texto As TextRange = parrafo.AppendText("descripcionDeLaAccion")
        texto.CharacterFormat.FontName = "Calibri"
        texto.CharacterFormat.FontSize = 12
        parrafo.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Left
        'Convierte el documento en arreglo de bytes
        Dim ms As MemoryStream = New MemoryStream()
        documentoCedula.SaveToStream(ms, FileFormat.Doc)
        Dim byteArray = ms.ToArray()
        Dim fileStream As FileStream = New FileStream("result.doc", FileMode.Create, FileAccess.ReadWrite)
        fileStream.Write(byteArray, 0, byteArray.Length)

If the issue still occurs, please provide your output file, your full code or a runnable project that could reproduce your issue for further investigation. You could send them to us via email (support@e-iceblue.com).

E-iceblue support team
You do not have the required permissions to view the files attached to this post.
User avatar

Posts: 1084
Joined: Tue Jul 09, 2019 2:22 am

Wed Feb 19, 2020 10:03 am


Greetings from E-iceblue!
How is your issue now? Could you please give us some feedback at your convenience?
Thanks in advance.

E-iceblue support team
User avatar

Posts: 1084
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc