Compatibility Mode - Office 2010/2013

Hello,
We have the following problem:
We generate a Word file that has a .doc extension, the document contains tables as part of the content.
When we open with Microsoft Word 2010 content is displayed correctly and completely,
but when we opened the document with Microsoft Word 2013 does not display table of the content within the file.

In Word 2013 , only to enter File - Convert Compatibility Mode show the content.
Why is that ?
How can we fix it.
We are using Aspose.Words for .NET library 15.6.0
Attached examples in Word 2010 and Word 2013

Hi Rodrigo,

Thanks for your inquiry. Please attach your input and output Word documents here for testing. Please also attach piece of code to reproduce this issue on our end. We will investigate the issue on our end and provide you more information.

Best regards,

Hi Awais,

Attached documents,

Best Regards.

Rodrigo Melgarejo.

Hi Rodrigo,

Thanks for your inquiry. Please comment the following lines in “Main” method and share “primera_generacion.doc” document here for testing:

// PARA REALIZAR LA AGRUPACION DE CONTENIDO DE LAS TABLAS
foreach (Aspose.Words.Tables.Table table in doc.GetChildNodes(NodeType.Table, true))
{
    foreach (Row row in table.Rows)
    {
        int totalDuplicate = 0;
        foreach (Row duplicateRow in table.Rows)
        {
            if (row.Range.Text.Trim().ToLower() == duplicateRow.Range.Text.Trim().ToLower())
            {
                totalDuplicate++;
                if (totalDuplicate > 1 && duplicateRow.Cells.Count == 1)
                {
                    duplicateRow.Remove();
                }
            }
        }
    }
}

Best regards,

Hi Awais , we performed the tests as we mentioned but unfortunately still with the same symptoms.
We attached file with the test results .
Regards.

Hi Rodrigo,

Thanks for your inquiry. All Word documents you attached in this thread just contain screenshots but they’re not the real documents that we can use to observe/reproduce the issue on our end. As suggested in my previous post, please attach real document “primera_generacion.doc”.

It would also be great if you please create a standalone runnable simple console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing. As soon as you get these pieces of information ready, we’ll investigate your issue and provide you more information. Thanks for your cooperation.

Best regards,

Hi Awais,

I Attached the files,

Rodrigo Melgarejo

Hi Rodrigo,

Thanks for your inquiry. This seems to be a bug of MS Word 2013 as even OpenOffice Writer version 4.1.1 can correctly open this document. MS Word 2013 can also display it correctly in ‘Web Layout’ mode. The problem does not occur when saving this document to DOCX format using following code.

Document doc = new Document(MyDir + @"primera_generacion1.doc");
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2013);
OoxmlSaveOptions opts = new OoxmlSaveOptions(SaveFormat.Docx);
opts.Compliance = OoxmlCompliance.Iso29500_2008_Transitional;
doc.Save(MyDir + @"15.8.0.docx", opts);

If we can help you with anything else, please feel free to ask.

Best regards,

Hi Aways
We apply the changes mentioned in our code and work to save the report
to a shared location Example : @“c:\primera_generacion1.docx”.

We need to save the file in a URL , but to save the file is corrupt
and can not be opened.

Attached to post the CS file where we generate the documents
and the procedure used to save the file to a URL

Moreover we attach screenshots SharePoint 2010 library and the generated
and stored in this document library , but in trying to open is corrupted.
Why could happen this situation? What are we doing wrong?

Could you help us?

Regards!

Hi Rodrigo,

Thanks for your inquiry. Please replace ‘saveToUrl’ method with the following:

// Guardar Documento en Direccion URL
public static void saveToUrl(Document docx, string url)
{
    docx.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2013);
    MemoryStream source = new MemoryStream();
    docx.Save(source, SaveFormat.Docx);
    byte[] sourceBytes = source.ToArray();
    WebClient client = new WebClient();
    client.Credentials = System.Net.CredentialCache.DefaultCredentials;
    Stream target = client.OpenWrite(url, "PUT");
    target.Write(sourceBytes, 0, sourceBytes.Length);
    source.Close();
    target.Close();
}

The MemoryStream.GetBuffer() method returns internal stream buffer and normally the size of this buffer is bigger than the actual stream length. Please try using the MemoryStream.ToArray() method instead. Hope, this helps.

Best regards,

Hi Awais,

I commented that testing with this code were not satisfactory, you could help with the resolution of it?

Best regards,

Rodrigo Melgarejo

Hi Rodrigo,

Thanks for your inquiry. We were unable to observe this issue in “primera_generacion1.doc” when using MS Word 2016. We have attached a screenshot here for your reference. The Table data is displayed correctly in MS Word 2016. So, we request you to please elaborate what problems are you still getting when using Aspose.Words 15.11.0?

Best regards,

Hi Awais,

It has made the requested update, but still with the same problem.

what else we could try?

Best Regards.

Rodrigo Melgarejo

Hi Rodrigo,

Thanks for your inquiry. Please upgrade to Aspose.Words for .NET 15.12.0 and MS Word 2016. Hope, this helps. In case the issue(s) still remain, please summarize what problem(s) are you still getting on your end. Also, please create a standalone simple console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing. We’ll investigate your issue(s) further and provide you more information. Thanks for your cooperation.

Best regards,