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:
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();
This code creates correct output, which is correctly displayed by Google Docs. Hope, this helps.