I'm looking for dificult template use cases!

This petition may sound weird but I really need your help with it!

I made a post days ago about the fact that we can create really, really, good reports using HTML/CSS.

Part 1 - Almost pixel perfect pdf reports from aut... - Google Cloud Community

I have practicing a lot and I keep being impressed by the amount of things that can be done compared to the traditional and kind of basic GDocs/MSWord way.

But I don't have all the use cases that could benefit from this amazing and powerfull way of templates.

That's why I'm asking you to give some of the most headache-given templates and maybe even ones that you weren't able to make to see how this thing I've learning could help you and also others!

At the same time I'd love to use some of these on my Part 2 of Pixel Perfect reports.

I'm planning to show you the use of the default AppSheet html-to-pdf conversion tool and a third party one that has full support for CSS Paged Media Module (the one that provides header, footer, automatic numbering, and more!)

As I said on the Part 1 of the trick, I'm really excited about all of this because of how powerful it is.

Let me know your complex GDocs/MSWord templates and I could give you an HTML/CSS version that -hopefully- works better and even one that works in case you weren't able to make it with traditional templates ๐Ÿ˜‰

9 60 3,057
60 REPLIES 60

Change it to this:

Show More
<!DOCTYPE html>
<html lang="es">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <style type="text/css">
      @Page {
        size: 21cm 29.7cm;
        margin: 0pt 0pt 0pt;
        orientation: portrait;
      }
      p {
        font-size: 10pt;
        font-family: "Arial";
        font-style: bold;
      }
      p.matricular {
        font-size: 6pt;
        font-family: "Arial";
        font-style: bold;
        color: red;
      }
      div.flex-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: start;
      }
      div.flex-child {
        text-align: center;
        flex: 1 1 33%;
      }
      div.flex-Herramienra {
        height: auto;
        width: 150px;
        text-align: center;
        font-weight: bold;
        font-family: "Arial";
        font-size: 12pt;
        vertical-align: middle;
      }
      div.flex-QR {
        height: 90px;
        width: 90px;
      }
      p.startifend {
        display: none;
      }
    </style>
  </head>
  <body>
    <div class="flex-container">
      <p class="startifend">
        &lt;&lt;Start: Filter(โ€œItemsโ€,[Familia]=[FamiliaInforme])&gt;&gt;
      </p>
      <div class="flex-child">
        <div class="flex-Logo">
          <img
            src="&lt;&lt;[Logo]&gt;&gt;"
            style="
              width: 180px;
              height: 35px;
              object-fit: scale-down;
              object-position: center center;
            "
          />
        </div>
        <div class="flex-Herramienra">
          <span style="color: #ea4335">&lt;&lt;[IDHerramienta]&gt;&gt;</span>
          <p>&lt;&lt;[Descripcion]&gt;&gt;</p>
          <p class="matricular">Maquinaria sin matricular</p>
        </div>
        <div class="flex-QR">
          <img
            src="&lt;&lt;[QR]&gt;&gt;"
            style="
              width: inherit;
              height: inherit;
              object-fit: scale-down;
              object-position: center center;
            "
          />
        </div>
      </div>
      <p class="startifend">&lt;&lt;End&gt;&gt;</p>
    </div>
  </body>
</html>

Thank you very much, with your solution I have almost achieved it, I just needed to move the QR to the right

Captura de pantalla 2023-11-26 103656.png

I have added this to the two containers, the div.flex-Herramienta and the div.flex-QR, and it already works perfectly

float: left;

 This is how the final code looks

<!DOCTYPE html>
<html lang="es">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <style type="text/css">
      @Page {
        size: 21cm 29.7cm;
        margin: 0pt 0pt 0pt;
        orientation: portrait;
      }
      p {
        font-size: 10pt;
        font-family: "Arial";
        font-style: bold;
      }
      p.matricular {
        font-size: 6pt;
        font-family: "Arial";
        font-style: bold;
        color: red;
      }
      div.flex-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: start;
      }
      div.flex-child {
        text-align: center;
        flex: 1 1 33%;
      }
      div.flex-Herramienra {
        height: auto;
        width: 150px;
        text-align: center;
        font-weight: bold;
        font-family: "Arial";
        font-size: 12pt;
        vertical-align: middle;
        float: left;
      }
      div.flex-QR {
        height: 90px;
        width: 90px;
        float: left;
      }
      p.startifend {
        display: none;
      }
    </style>
  </head>
  <body>
    <div class="flex-container">
      <p class="startifend">
        &lt;&lt;Start: Filter(โ€œItemsโ€,[Familia]=[FamiliaInforme])&gt;&gt;
      </p>
      <div class="flex-child">
        <div class="flex-Logo">
          <img
            src="&lt;&lt;[Logo]&gt;&gt;"
            style="
              width: 180px;
              height: 35px;
              object-fit: scale-down;
              object-position: center center;
            "
          />
        </div>
        <div class="flex-Herramienra">
          <span style="color: #ea4335">&lt;&lt;[IDHerramienta]&gt;&gt;</span>
          <p>&lt;&lt;[Descripcion]&gt;&gt;</p>
          <p class="matricular">Maquinaria sin matricular</p>
        </div>
        <div class="flex-QR">
          <img
            src="&lt;&lt;[QR]&gt;&gt;"
            style="
              width: inherit;
              height: inherit;
              object-fit: scale-down;
              object-position: center center;
            "
          />
        </div>
      </div>
      <p class="startifend">&lt;&lt;End&gt;&gt;</p>
    </div>
  </body>
</html>

And this is the result

Captura de pantalla 2023-11-26 104631.png

Once again I want to thank you for your help and knowledge, especially for discovering a new world of possibilities when generating all types of PDFs

I'm very happy to hear that! ๐Ÿ˜ƒ

Hello @SkrOYC , 

Google Search lead me to this valuable post. 
Am not so much into HTML and inline CSS, where i might require your help if this thread is still opened, though, my task might not be that complex as you wish.

I have the following docs template that generates a pdf, but the page break make it meassy sometimes and i love to convert it into .html file instead. 

https://docs.google.com/document/d/1H5izxp8Qq19UoeHX2mTYJ7DSh6jEMQY4mgc_uppezLs/edit?usp=sharing

The idea is to keep every truck ref on a single page and avoid having the page breaking randomly , cutting the refs, or having two refs on one page. i tried but couldn't make it work.
If you may require more info please let me know. 

Thanks in advance

Let me check this next week since I'm currently full of work.

It's totally doable

Thanks for your response,  appreciated.  No rush ! Tyt 

Am gonna playe around with the generic tempmate you posted in your other post as well. 

 

Thanks again

@SkrOYC 
I could finally do it, thanks to your previous posts about css inline, html, and page-breaks

Btw, Inline is just needed when using CSS on email body templates.
For the attachment, you can use regular CSS with selectors inside the "style" tag, which is way more practical

Estimado SkrOYC, muito bom dia,

Passando aqui para apresentar esse desafio que tem me deixado muito tempo com dor de cabeรงa. Se trata de um cartรฃo de membro que desejo enviar via Appsheets para todos os nossos colaboradores.
Neste cรณdigo HTML desejo trazer de forma dinรขmica, poucos dados pessoais dos membros, uma foto e um cรณdigo qr.
Todas as colunas referenciadas para esses dados, estรฃo dispostas no Google Sheets em forma de texto.

O cรณdigo รฉ esse:

<html>
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Carteira de Credencial de Membro</title>
 <style type="text/css">
    body {
      font-family: Arial, sans-serif;
      background-color: #f2f2f2;
      margin: 0;
      padding: 20px;
    }
    .card {
      background-image: url("https://www.adefeeuropa.com/wp-content/uploads/2023/06/MODELO-CARTEIRA-DE-MEMBRO-ADEFE.png");
      background-size: cover;
      color: #000000;
      border-radius: 5px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      width: 70.00mm;
      height: 100.00mm;
      padding: 20px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 1px;
    }
    .logo-container {
      display: flex;
      align-items: center;
      margin-bottom: 15px;
      color: #ffffff;
    }
    .logo {
      width: 30px;
      height: 30px;
      margin-right: 0px;
      margin-top: -15px;
    }
    .org-name {
      font-weight: bold;
      font-size: 9pt;
      margin-top: -15px;
      text-align: center;
      margin-right: 15px;
    }
    .title {
      font-size: 8pt;
      margin-top: -10px;
      text-align: center;
      color: #ffffff;
      margin-right: 0px;
    }
    .photo {
      width: 173px;
      height: 173px;
      border-radius: 50%;
      margin-right: -2px;
      margin-top: 7px;
      object-fit: cover;
      object-position: center top;
    }
    .member-info {
      margin-top: 10px;
      font-size: 7pt;
      text-align: center;
    }
    .member-info label {
      font-weight: bold;
    }
    .qr-code {
      margin-top: 3px;
      width: 70px;
      height: 70px;
      text-align: center;
    }
  </style>
</head>
<body>
  <div class="card">
    <div class="logo-container">
      <img class="logo" src="https://www.adefeeuropa.com/wp-content/uploads/2017/12/cropped-Logo-รCONE-512-2-1.png" alt="Logo" >
     <div class="org-name">Assembleia de Deus<br/>Fogo para Europa</div>
    </div>
    <div class="title">Portugal - Europa | NIPC 592010082</div>
           <img class="photo" src="&lt;&lt; [URL Fotografia Perfil] &gt;&gt;" alt="Photo" />
    <div class="member-info">
      <label>CERTIDรƒO ELETRร”NICA</label>
    </div>
    <div class="member-info">
      <label>Nome | </label>
      <span>&lt;&lt; [Nome Completo] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>E-mail | </label>
      <span>&lt;&lt; [Email] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>Cรณd.ID | </label>
      <span>&lt;&lt; [ID C&#243;d] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>Registro desde | </label>
      <span>&lt;&lt; Date([Submission Date]) &gt;&gt;</span>
    </div>
           <img class="qr-code" src="&lt;&lt; [QR-Code] &gt;&gt;" alt="Qr-Code ID" />
  </div>
</body>
</html>

Thank you in advance for your valuable attention to this error:
Error 1 : '<', hexadecimal value 0x3C, is an invalid attribute character. Line 72, position 421.

Estimado SkrOYC, muito bom dia,

Passando aqui para apresentar esse desafio que tem me deixado muito tempo com dor de cabeรงa. Se trata de um cartรฃo de membro que desejo enviar via Appsheets para todos os nossos colaboradores.
Neste cรณdigo HTML desejo trazer de forma dinรขmica, poucos dados pessoais dos membros, uma foto e um cรณdigo qr.
Todas as colunas referenciadas para esses dados, estรฃo dispostas no Google Sheets em forma de texto.

O cรณdigo รฉ esse:

<html>
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Carteira de Credencial de Membro</title>
 <style type="text/css">
    body {
      font-family: Arial, sans-serif;
      background-color: #f2f2f2;
      margin: 0;
      padding: 20px;
    }
    .card {
      background-image: url("https://www.adefeeuropa.com/wp-content/uploads/2023/06/MODELO-CARTEIRA-DE-MEMBRO-ADEFE.png");
      background-size: cover;
      color: #000000;
      border-radius: 5px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      width: 70.00mm;
      height: 100.00mm;
      padding: 20px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 1px;
    }
    .logo-container {
      display: flex;
      align-items: center;
      margin-bottom: 15px;
      color: #ffffff;
    }
    .logo {
      width: 30px;
      height: 30px;
      margin-right: 0px;
      margin-top: -15px;
    }
    .org-name {
      font-weight: bold;
      font-size: 9pt;
      margin-top: -15px;
      text-align: center;
      margin-right: 15px;
    }
    .title {
      font-size: 8pt;
      margin-top: -10px;
      text-align: center;
      color: #ffffff;
      margin-right: 0px;
    }
    .photo {
      width: 173px;
      height: 173px;
      border-radius: 50%;
      margin-right: -2px;
      margin-top: 7px;
      object-fit: cover;
      object-position: center top;
    }
    .member-info {
      margin-top: 10px;
      font-size: 7pt;
      text-align: center;
    }
    .member-info label {
      font-weight: bold;
    }
    .qr-code {
      margin-top: 3px;
      width: 70px;
      height: 70px;
      text-align: center;
    }
  </style>
</head>
<body>
  <div class="card">
    <div class="logo-container">
      <img class="logo" src="https://www.adefeeuropa.com/wp-content/uploads/2017/12/cropped-Logo-รCONE-512-2-1.png" alt="Logo" >
     <div class="org-name">Assembleia de Deus<br/>Fogo para Europa</div>
    </div>
    <div class="title">Portugal - Europa | NIPC 592010082</div>
           <img class="photo" src="&lt;&lt; [URL Fotografia Perfil] &gt;&gt;" alt="Photo" />
    <div class="member-info">
      <label>CERTIDรƒO ELETRร”NICA</label>
    </div>
    <div class="member-info">
      <label>Nome | </label>
      <span>&lt;&lt; [Nome Completo] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>E-mail | </label>
      <span>&lt;&lt; [Email] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>Cรณd.ID | </label>
      <span>&lt;&lt; [ID C&#243;d] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>Registro desde | </label>
      <span>&lt;&lt; Date([Submission Date]) &gt;&gt;</span>
    </div>
           <img class="qr-code" src="&lt;&lt; [QR-Code] &gt;&gt;" alt="Qr-Code ID" />
  </div>
</body>
</html>

Thank you in advance for your valuable attention to this error:
Error 1 : '<', hexadecimal value 0x3C, is an invalid attribute character. Line 72, position 421.

Hey @SkrOYC I'm a little late to this but are you able to help with templates? I have been playing about with some CSS/HTML templates which aren't very good. 

I've been battling a personal issue lately, but please put your requirement here so we can help!

Sorry to hear that, hope it turns out well..

I would like some help with my template code: it will be a report of all rooms + items inside a property. It will include images, descriptions etc. Reports can end up 70, 80 pages long. What would you need to help?

I'm sorry to hear that. I will be praying for you that you will be victorious in everything! God bless you

Estimado SkrOYC, muito bom dia,

Passando aqui para apresentar esse desafio que tem me deixado muito tempo com dor de cabeรงa. Se trata de um cartรฃo de membro que desejo enviar via Appsheets para todos os nossos colaboradores.
Neste cรณdigo HTML desejo trazer de forma dinรขmica, poucos dados pessoais dos membros, uma foto e um cรณdigo qr.
Todas as colunas referenciadas para esses dados, estรฃo dispostas no Google Sheets em forma de texto.

O cรณdigo รฉ esse:

<html>
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Carteira de Credencial de Membro</title>
 <style type="text/css">
    body {
      font-family: Arial, sans-serif;
      background-color: #f2f2f2;
      margin: 0;
      padding: 20px;
    }
    .card {
      background-image: url("https://www.adefeeuropa.com/wp-content/uploads/2023/06/MODELO-CARTEIRA-DE-MEMBRO-ADEFE.png");
      background-size: cover;
      color: #000000;
      border-radius: 5px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      width: 70.00mm;
      height: 100.00mm;
      padding: 20px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 1px;
    }
    .logo-container {
      display: flex;
      align-items: center;
      margin-bottom: 15px;
      color: #ffffff;
    }
    .logo {
      width: 30px;
      height: 30px;
      margin-right: 0px;
      margin-top: -15px;
    }
    .org-name {
      font-weight: bold;
      font-size: 9pt;
      margin-top: -15px;
      text-align: center;
      margin-right: 15px;
    }
    .title {
      font-size: 8pt;
      margin-top: -10px;
      text-align: center;
      color: #ffffff;
      margin-right: 0px;
    }
    .photo {
      width: 173px;
      height: 173px;
      border-radius: 50%;
      margin-right: -2px;
      margin-top: 7px;
      object-fit: cover;
      object-position: center top;
    }
    .member-info {
      margin-top: 10px;
      font-size: 7pt;
      text-align: center;
    }
    .member-info label {
      font-weight: bold;
    }
    .qr-code {
      margin-top: 3px;
      width: 70px;
      height: 70px;
      text-align: center;
    }
  </style>
</head>
<body>
  <div class="card">
    <div class="logo-container">
      <img class="logo" src="https://www.adefeeuropa.com/wp-content/uploads/2017/12/cropped-Logo-รCONE-512-2-1.png" alt="Logo" >
     <div class="org-name">Assembleia de Deus<br/>Fogo para Europa</div>
    </div>
    <div class="title">Portugal - Europa | NIPC 592010082</div>
           <img class="photo" src="&lt;&lt; [URL Fotografia Perfil] &gt;&gt;" alt="Photo" />
    <div class="member-info">
      <label>CERTIDรƒO ELETRร”NICA</label>
    </div>
    <div class="member-info">
      <label>Nome | </label>
      <span>&lt;&lt; [Nome Completo] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>E-mail | </label>
      <span>&lt;&lt; [Email] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>Cรณd.ID | </label>
      <span>&lt;&lt; [ID C&#243;d] &gt;&gt;</span>
    </div>
    <div class="member-info">
      <label>Registro desde | </label>
      <span>&lt;&lt; Date([Submission Date]) &gt;&gt;</span>
    </div>
           <img class="qr-code" src="&lt;&lt; [QR-Code] &gt;&gt;" alt="Qr-Code ID" />
  </div>
</body>
</html>

Thank you in advance for your valuable attention to this error:
Error 1 : '<', hexadecimal value 0x3C, is an invalid attribute character. Line 72, position 421.

Did you add the format rule for the [QR-Code] column? It should be Text

Control the image width in a webhook - AppSheet Help

Yes!

ADEFE_EUROPA_0-1711761920209.png

Error 1 : '<', hexadecimal value 0x3C, is an invalid attribute character. Line 72, position 421.
Line 72:

ADEFE_EUROPA_1-1711761959351.png

 

I'd love to see a label template that prints avery labels properly.  Something like Avery 5095 labels.  

Yo lo logrรฉ, mira mis respuestas y verรกs el cรณdigo, el que puse imprimรญa etiquetas en A4, pero si modificas el ancho y alto de la pagina en el CSS y colocas la medida de tu etiqueta, las colocarรก una detrรกs de otra. Yo tengo una impresora con unas etiquetas de 60mm x 35mm y coloco esa medida luego tienes que ajustar los tamaรฑos de los contenedores para enviarlo todo dentro y ya funciona.

Top Labels in this Space