Docx: Wrong Table width when preview file & uploading Google Docs

Created on 7 Dec 2018  路  6Comments  路  Source: dolanmiu/docx

Hi, dolanmiu. Thank you for awesome library.

I has a problem when creating a full-width table with code:

const table = doc.createTable(3, headers.length) table.setWidth(WidthType.PERCENTAGE, '100%')

It works fine when open in Microsoft Word, but wrong width when preview in Google Docs or Finder (I'm using MacOS).

Microsoft Word:

screen shot 2018-12-07 at 5 12 03 pm

Google Docs:

screen shot 2018-12-07 at 4 58 57 pm

Finder Preview:

screen shot 2018-12-07 at 5 12 29 pm

Hard bug

Most helpful comment

Would you please write somewhere in the documentation with bold font that this package does not support google docs ? It took more than 2 days for me to find it out and see this issue with table width. Thanks

All 6 comments

Yes, Gogole docs, or finder is not supported

Only Microsoft Word so far

If you can figure out how to get the features working in each, that would be amazing

I use Tab Stops to work around this, they work perfectly in both Pages and Google Docs.

Would you please write somewhere in the documentation with bold font that this package does not support google docs ? It took more than 2 days for me to find it out and see this issue with table width. Thanks

@vahid18u if you want you can add the warning on the documentation yourself and open a PR,

I use Tab Stops to work around this, they work perfectly in both Pages and Google Docs.

Hi @carlbolduc , can you please explain how you use tab stops in your workaround? Everything else is working fine in my document, but tables. If your workaround works, you made my day!!

Hi @carlbolduc , can you please explain how you use tab stops in your workaround? Everything else is working fine in my document, but tables. If your workaround works, you made my day!!

Here is an example, I first create a line like this:

const line = this.doc.createParagraph().bullet().maxRightTabStop();

I can then add content to it:

line.createTextRun('Stuff...');

And use tab stops to simulate a table:

line.createTextRun('Other stuff').tab();
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sleepinzombie picture sleepinzombie  路  3Comments

liquidslr picture liquidslr  路  4Comments

GiladFeder picture GiladFeder  路  6Comments

iainfreestone picture iainfreestone  路  3Comments

zahrafali picture zahrafali  路  3Comments