G Suite Compatibility | Support GDOC File Format | Display Line Shapes & Tables in Headers Footers using Java

Hello Team,
At present we are using Aspose license to generate Word (docx), Excel (xlsx) and PDF files. We plan to migrate to GSuite near by. We would like to know the Aspose compatibility to generate the files with GSuite compliance.

The Word file has Headers and Footers with Dynamic information. It is getting affected if we open the docx file (which is generated via Aspose API) in Googles Docs.

We are in need of technical support for GSuite migration.
Thanks,
Dinesh Rajan.

@ra.dinesh,

Ideally, there should not be any issue when loading the documents generated by Aspose APIs into different G Suite tools/apps. Similarly, Aspose APIs should be able to process G Suite generated documents without any issue. However, please note that Aspose.Words and Aspose.Cells APIs are designed to mimic the behaviors of MS Word and MS Excel desktop apps.

Please ZIP and upload your simplified input Word document, Aspose.Words generated DOCX file showing the undesired behavior (in Googles Docs) and a piece of source code here for testing. We will then investigate this particular issue on our end and provide you more information.

Hello team,
Here I have attached sample code and output document which is generated by Aspose. And please confirm, whether can we generate word document with gdoc extension (test.gdoc) using Aspose libraries.Aspose.zip (198.8 KB)

@ra.dinesh,

We tested the scenarios and have managed to reproduce the same problems on our end. For the sake of corrections, we have logged the following issues in our issue tracking system.

WORDSNET-20309: G Suite Compatibility - Support GDOC File Format
WORDSNET-20310: Google Docs does not display Line Shapes in Headers/Footers
WORDSNET-20311: Google Docs does not recognize Table Column Widths in Headers/Footers

We will further look into the details of these issues and will keep you updated on the status. We apologize for your inconvenience.

@ra.dinesh,

Regarding WORDSNET-20309, please note that the .gdoc file extension was developed by Google as a Web shortcut file format. These GDOC files point to documents that are in Google Drive, which is a cloud storage service provided by Google. A .gdoc file does not contain any other data aside from the encoded location of an associated document in Google Drive. Each time a user saves a document in Google Drive through the Docs app, a GDOC file is created. These GDOC files are usually stored in a user’s Google Drive folder, which is synchronized with the service. Upon clicking these .gdoc files, the user’s default Web browser takes the user to the corresponding document.

.gdoc and .gsheet etc - these extensions are usually linked to the Google Drive application, which just reads the file and opens the URL with your standard browser.

For example .gsheet file contains the following source code:

{"url":"https://docs.google.com/a/test.com/spreadsheet/ccc?key=01234567898765432123456789&usp=docslist_api", "resource_id": "spreadsheet:0A12345B678HJK9TZPL9078767"}

So, it is ease to create this shortcut file without using Aspose.Words or Aspose.Cells.

@ra.dinesh,

Regarding WORDSNET-20310, ‘Google Docs failing to display such Line Shapes’ does not seem to be an issue with Aspose.Words API. It seems to be a Google Docs bug instead.

At the same time, Google Docs UI has the ability to create a horizontal line.
Insert -> Horizontal line.

And to create a horizontal line with the same manner as Google Docs, please, use this code:

DocumentBuilder.insertHorizontalRule();

So, Google Docs is unable to display VML shapes. The exception is HorisontalRule, which is available via Google Docs GUI.

If you want to draw something different to HorizontalRule, then you must use DML shapes. Google Docs correctly displays DML shapes.

When you create a shape by using a “new Shape(doc, ShapeType.LINE)” constructor, the VML shape is created. To avoid this, you can create a DML shape by specifying a ShapeMarkupLanguage.DML, or by using such simple code:

DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertShape(ShapeType.LINE, 300, 0);

Additionally, we must specify a proper OoxmlCompliance. In the case when OoxmlCompliance.ECMA_376_2006 is specified, DML shapes will be replaced with its VML FallBack on saving. So, on saving we can use this code:

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.setCompliance(OoxmlCompliance.ISO_29500_2008_TRANSITIONAL);

doc.save("X:\\work\\20310\\out.docx", saveOptions);

This code creates correct output, which is correctly displayed by Google Docs. Hope, this helps.

@ra.dinesh,

Regarding WORDSNET-20311, we have decided to close this issue also with ‘Not a Bug’ status. The problem occurs because you are specifying widths of Cells by using the CellFormat.Width property. Setting width by using this property is not recommended, instead you should use CellFormat.PreferredWidth property. Setting PreferredWidth specifies a value and a type and you will see correct output in Google Docs in this case.