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 :wink:

9 Likes

This does look really promising, I’ll have to dust off my CSS skills, I used to do a lot of web page development!

There was a question on here recently, about a week ago I think, but I couldn’t find it. From what I remember there person wanted to display three records side by side in a template. The records had an image, comment and date I think and they wanted it to appear like this:

Image 1 Image 2 Image 3
Caption 1 Caption 2 Caption 3
Date 1 Date 2 Date 3

The problem is of course with a template, when you iterate through records and use tables, you can only get a row at a time. I’m pretty sure that if each table was a record (so the start and end expressions wrap a

rather than a ) then you could use CSS to place the tables alongside each other How To Create Side-by-side Tables

1 Like

Are you talking about this one?

Re: Email template - Google Cloud Community

I gave him an answer where I made a template with a div container with display: flex

2 Likes

That’s the one! Obviously too easy then, I’ll have to think of something more difficult :grin:

Nah, I would have ended given up two months ago with something like that.
Now I’m already able to create a full book with the Paged Media Module.

It’s the one doing the magic

I’m going to share some reference to good articles and videos about it on the Part 2 of the trick.

But I need more challenges to practice!

2 Likes

You may well be doing this already, but perhaps some of the CSS itself could be stored in tables in AppSheet. This could allow for users to select the “theme” or other options for their reports. You could have some specific styling options like font and background colours stored either in user settings or a user preferences table. Then pull them into the template along with the data, either selecting from a predefined list of classes or IDs or even actual values in the style section of the header.

1 Like

About that, I haven’t played with AppSheet expression inside the CSS, just on HTML.

I tried a very simple thing some time ago when I was just starting on this and it didn’t work.

BTW, @Phil I always wondered about <> on CSS. Do you have any insight that can be helpfull?

1 Like

If anyone is interest:

Have you ever wondered how to add an image to a template but control the size completely and prevent AppSheet from generating an anchor () aka hyperlink with it?

You need a format rule on the IMG column to make it Text and then on your HTML template you call the IMG collumn inside the tag as source.

Like this:

<img src="<<[IMG]>>" width="whatever" height="whatever">

If someone wants a template, let me know!

8 Likes

Another one:

How do you make sure to have the table header on every page after a page break? For example, the data inside the table is so big that it has to break into more pages but the headers are lost?

Well, it’s a GDocs/MSWord template problem.

Table headers on HTML make this work by default.

If the data is too long and there are page breaks, the info on the is printed again on the next page.

Now you know!

3 Likes

How can you add page break at will?

CSS makes it easy.

There is a property that can be added to any html tag.

You can make it add a page break before or after a certain tag, for example before tables, titles, paragraphs, images, etc.

This way you could make a paginated report where each Title is on a new page and at the top of it

An example of this is on my Part 1 post explaining the usage of HTML/CSS as templates:

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

Just make a text file with this inside:

Show More

    
    
    

    
        # This is a sample doc made today
<<TODAY()>>
 by <<LOWER(USEREMAIL())>>

    

    
        <table>

            
            
                <tr>

                    <th>

HEADER
This one is 15% of the width

</th>

                    <th>

HEADER
This one is 30% of the width

</th>

                    <th>

HEADER
This one is 40% of the width

</th>

                    <th>

HEADER
This one is 15% of the width

</th>

                </tr>

            
            
                <tr>

                    <td>

ROW 1

</td>

                    <td>

ROW 1

</td>

                    <td>

ROW 1

</td>

                    <td>

15

</td>

                </tr>

                <tr>

                    <td>

ROW 2

</td>

                    <td>

ROW 2

</td>

                    <td>

ROW 2

</td>

                    <td>

5

</td>

                </tr>

                <tr>

                    <td>

ROW 3

</td>

                    <td>

ROW 3

</td>

                    <td>

ROW 3

</td>

                    <td>

24

</td>

                </tr>

                <tr>

                    <td colspan="3">

Total

</td>

                    <td>

44

</td>

                </tr>

            
        </table>
    

    
        # And this is on a new page. Page break baby!

    

    
        <table>

            
            
                <tr>

                    <th>

HEADER
This one is 15% of the width

</th>

                    <th>

HEADER
This one is 30% of the width

</th>

                    <th>

HEADER
This one is 40% of the width

</th>

                    <th>

HEADER
This one is 15% of the width

</th>

                </tr>

            
            
                <tr>

                    <td>

ROW 1

</td>

                    <td>

ROW 1

</td>

                    <td>

ROW 1

</td>

                    <td>

15

</td>

                </tr>

                <tr>

                    <td>

ROW 2

</td>

                    <td>

ROW 2

</td>

                    <td>

ROW 2

</td>

                    <td>

5

</td>

                </tr>

                <tr>

                    <td>

ROW 3

</td>

                    <td>

ROW 3

</td>

                    <td>

ROW 3

</td>

                    <td>

24

</td>

                </tr>

                <tr>

                    <td colspan="3">

Total

</td>

                    <td>

44

</td>

                </tr>

            
        </table>
    

And save it as .html

Then use it instead of a GDocs/MSWord file and you will see

3 Likes

Thank you @SkrOYC !

2 Likes

Did you know that you could have a dinamic index with hyperlinks to each part of your paginated report using HTML/CSS?

Well, with some Start: expressions, this is a piece of cake.

Coming soon on my Part 2

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

2 Likes

@SkrOYC I would like to have some templates, also how a temaplate looks like with a header and that the next page the childtable-output starts on a proper place beneath a header?

Hi @Peter_Bernsen

When it comes to headers and footers, the AppSheet backend doesn’t support it (they use Skia, same one used by Chromium), but I’m ending my Part 2 where I explain some workarounds using another service that supports full CSS styling.

About the table headers, yes, HTML tables support that by default. So if you have a lot of rows, the next page will have the table header.

Do you have a screenshot of your actual template?

1 Like

@Aurelien @Peter_Bernsen @graham_howe

Take a look at Part 2, for sure you will find something useful there

Part 2: Pixel perfect paginated reports - Google Cloud Community

3 Likes

Hey budy! I was taking a look at these comments and found that I already did this on Part 3, I’m planning on posting it on the next 2 weeks. So I guess you will like it @graham_howe
I didn’t added CSS inside a record but used some styling that’s applied dynamically via CSS

1 Like

Is not working!

@SkrOYC

1 Like

You made the format rule?

Hi @SkrOYC ,
Firstly, I have to say that you are doing a great job sharing all that stuff with us. Thank you for that! I think I have a question directly related to this topic but wasn’t sure if this is the best place to ask this question. The thing is about custom HTML templates, Outlook & AppSheet… Do you also find it troublesome? Maybe you have some tricks that are important to know while coding and implementing. I write quite a lot of templates and there is always a problem with rendering in Outlook desktop app. This topic is about difficult template use cases, here it is (at least for me) :sweat_smile:
Regards

When it comes to Email, please check this awesome site:
Welcome to the arrogantly named library of, Good Email Code | good-email-code

The thing is, each email client can render the email differently. Outlook is the worst of them (and I find Thunderbird to be the best, the one I use btw) because it renders HTML using MSOffice or particularily MSWord’s engine.

So, long story short, you can only do some stuff look great with Outlook and HTML emails

2 Likes