Template google docs - columns width issue

Aurelien
Google Developer Expert
Google Developer Expert

Hi there

I’m struggling with changes in columns width, like that:


because I use nested Start/Select/If and so on, I use a Docs template with various tables.
Here is what my template looks like:

[…]

Despite setting specific columns widths, I cannot make it stick to settings.
It’s like my settings are ignored, and the widths are self-determined, depending on having value in the cell, and other things I don’t understand.

I know this is a known difficulty, but I didn’t find a way to fix that.
I looked there:

But because of my structure, I guess each row in the PDF is interpreted as an html independent table.

Does someone have a clue ?

Many thanks in advance for your help !

Solved Solved
0 16 7,187
1 ACCEPTED SOLUTION

Yes. adjusting column widths can get temperamental. But a couple of insights may help.

  1. In the Google tables, explicitly set the columns widths for all columns except 1. Usually this would be a column that has lengthy entries. By setting them this way, the single column will take up “left-over” space of the table. Once you have the widths set - DO NOT TOUCH the visual column sliders. Always adjust the columns through the Table properties.

I see you have a Header row, body section of rows and then a Summary row. You would need to set the column widths of each of these separate tables using the Table Properties so they are of EXACTLY the same width - leaving the same single column Not set to take up remaining table space

  1. For the body rows, each occurrence of a set rows associated with the START/END blocks constitutes a new table and may be subjected to differing column widths if 1) above is not followed. Usually because there is more than one column WITHOUT a width set.

In your case, I see you have a START/END block OUTSIDE of the row template for the body rows and then another START/END block inside of the template row table. Sets of rows associated with each occurence of the OUTSIDE START/END would actually each be in their own table and depending on column width settings and the data, columns could end up with different widths causing the mis-alignment of rows.

View solution in original post

16 REPLIES 16

I have encountered this many times, and have attempted to figure out why some columns get their width adjusted beyond the setting, but unfortunately so far do not have any answers.

I typically just make the tables’ grid lines invisible so the “jitter” is less obvious.

3X_d_5_d54eebd9bc4487fb41c830ce45dac357ef7a066e.png

Hi @Marc_Dillon

Thanks for your answer.
Yes I saw you spent some time struggling with that
The weirdest thing in my opinion, is that the column width seems to adjust to content, but not everytime as we can see on the first column in the capture, if we compare header and body…and footer.

I read a post talking about adding <> on first column/row, and last as well. Did that trick worked for you ?

EDIT :
On the picture you see there, I made a workaround adding some useless values in order to keep some “acceptable” alignment, because in my case I could have some values 2 columns away from their expected location.

I agree. If I had expanded the above screenshot to show you the rest of those rows, there is no obvious reason (like content length/size) why any of those rows would be expanded while the other are not, nor that any of those rows’ content would even require any expansion.

I don’t know what this means.

I don’t know what this means.

This:

In addition, I did not look yet but do you know if trying to use some HTML or JSON template will give better result ?
I’m not familiar with these and then try to avoid having to look into that

No, whatever Reza was talking about in that very old post (was actually originally from the GooglePlus community, and just archived here), I highly doubt is applicable to this situation.

Unfortunately you can’t add custom HTML to a GDoc template. You can do it in the Email Body field directly in the workflow definition. Or you can write a custom html template file (I think as a .txt file stored on GDrive). But that’ll be difficult and time-consuming, especially if you don’t know HTML.

That’s exactly what I’m afraid of
I’ve been dealing with HTML a few month ago for a side-page purpose, but I agree this is an entirely new language to apprehend

I’ve edited the referenced post to clarify the <<Start>> and <<End>> tag references.

Wooo, that makes much more sense with start and end in this post

My experience is that this is usually due Indentation and/or Padding values.

Yes. adjusting column widths can get temperamental. But a couple of insights may help.

  1. In the Google tables, explicitly set the columns widths for all columns except 1. Usually this would be a column that has lengthy entries. By setting them this way, the single column will take up “left-over” space of the table. Once you have the widths set - DO NOT TOUCH the visual column sliders. Always adjust the columns through the Table properties.

I see you have a Header row, body section of rows and then a Summary row. You would need to set the column widths of each of these separate tables using the Table Properties so they are of EXACTLY the same width - leaving the same single column Not set to take up remaining table space

  1. For the body rows, each occurrence of a set rows associated with the START/END blocks constitutes a new table and may be subjected to differing column widths if 1) above is not followed. Usually because there is more than one column WITHOUT a width set.

In your case, I see you have a START/END block OUTSIDE of the row template for the body rows and then another START/END block inside of the template row table. Sets of rows associated with each occurence of the OUTSIDE START/END would actually each be in their own table and depending on column width settings and the data, columns could end up with different widths causing the mis-alignment of rows.

Thanks John! That gives me an idea of something to try the next time I’m building one of these complex templates.

Thank you both @WillowMobileSystems and @Marc_Dillon for sharing your experience about that, that comforts me in the choice I made about how to build this report.
I will give a try to tips provided by @WillowMobileSystems, then stick with what I get.

Cheers !

EDIT :
Just voted that, if you are interested ?

@Aurelien If you keep having problems with this I could help you create an html table. I learned a lot these last months.

I had the same problem before (using MSWord) but now it's almost pixel perfect

HTML tables allow you to define parts for it. Table Header, Table Body and Table Footer. And you can make all of them share a custom column width accross those parts

Aurelien
Google Developer Expert
Google Developer Expert

Hi @SkrOYC 

 

Thank you very much. I eventually learnt to accept this width-moving  🤣

 

More seriously, I'm really interested into knowing how you manage this. I read a post you made a few days ago that seems promising, but I didn't take time to dig further by lack of time.

This is this one:

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Part-1-Almost-pixel-perfect-pdf-reports-from-aut...

 

I'm definitely not an HTML-programmer, so I think I will need to dig a little before getting something acceptable.

Using this kinf of tip may help into first-stepping this: basically, it comes to save the Google Docs template into a html file.

https://support.google.com/docs/thread/95093737/how-to-convert-google-doc-to-html?hl=en

 

But from this, make it a nice PDF template...well, I will need some time then ! 🙄

 

In a perfect world, I would love to combine such HTML template with expressions such as Start/End/If/EndIf.

Would you mind sharing the visual result of your experiments ?

I suggest we continue this conversation on your other thread, yours 😉

 

Hi @Aurelien 

I'll tag you on the Part 1 post to show you some examples.

See you there!

Top Labels in this Space