Page breaks in Word doc templates

According to the 'documentation', Google Docs templates can contain page breaks which work in PDFs.

This doesn't seem to work for Word Doc templates. Is there a way to achieve a solid page break in an emailed PDF generated from a Word Doc template?

 

0 14 807
14 REPLIES 14

The information on it in this page is incorrect.

https://help.appsheet.com/en/articles/5297458-using-microsoft-word-templates

 

This have worked for me:

SkrOYC_0-1646406053509.png

You can even make a Page Break between an IF so that it will insert the page break just when it's needed

https://help.appsheet.com/en/articles/2697069-template-if-expressions


@JamesWB wrote:

The information on it in this page is incorrect.


What part is incorrect?

Note: You will not be able to control the insertion of Page breaks within a data table based on a row selection function - i.e. START/END template expressions. 

The number of rows will dictate the size of this template table.  If the number of rows cause the table to spill over onto the next page and that next page in the template had began with a Page Break, a new page will be inserted into the resulting document as the second page to cover the "extra" table rows.  The Page Break will then begin on the third page.  This will mean you might have a mostly blank second page.

 

BTW, the only way to solve this would require IF() on template as well as expressions to decide whether to include X number of rows and then start on the next page from X+1? I'm thinking out loud about the way to have the column headers on the next page

Here's an explanation from Grant Stead at Google. Apparently they don't support page breaks from Word templates, so my assertion that the documentation is wrong is apparently correct.

https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/Bugs-in-PDF-processing-from-a-Google-Doc/m-p/24...

Grant Stead doesn't work at Google afaik, he's another good and experienced user of this community. He took what the documentation says:

https://help.appsheet.com/en/articles/2993234-microsoft-word-email-templates

The fact that something doesn't work automatically doesn't mean that can't be done by workarounds, it's maybe 30+40% of the potential of AppSheet, the workarounds made by experienced users.

As I told you before, if page breaks are not automatic, you can deal with them using a template IF()

SkrOYC_0-1646754800047.png

If it works for me, for sure you can do it

It worked for you just adding a page break? In a Word document template?

Which version of Word were you using for the template?

By the way I've just done am extremely simple Word template with only 2 sentences and an inserted page page break between them and the page break did not work, so it appears Grant's comments were correct.

 

I have no idea how to insert page breaks at selected points in a long Word template using IF statements. How would you even start?

Actually it doesn't matter, it's just a .docx

I have forgotten how many times I have updated MSOffice, it gets regular updates now and then.

Right now I'm on Microsoft 365 MSO Version 2202 compilation 16.0.14931.20116 if you need to know, but I have made this template long ago.

If it's a Start: or If: just make sure to open it on the previous page of the page break and <<End>> it on the new one

I know how to use Start and End, what I'm not clear about is how you would make a page break (which doesn't work in any Word template I've tried) work in that context any differently to a context where it isn't in a statement. I just tried doing a simple one and it didn't work. Can you post the code you used in your template please?

Since you just told us that Page Breaks are not working for you, can you explain what are you trying to do actually? Maybe I could help you get what you need to do as a workaround.

If it's a table that has a lot of rows you would need to add page breaks based on the amount of records you are able to add to each page. That's the way I would do it and for sure I'm not an expert.

In my case I have a template that creates a report on the first page and then adds one image per page, each image is a receip that corresponds to the records on the first page, so there is one page per image

OK, that sounds interesting and obviously programmatic. My need is simple - I just want one particular new section of a long multi-page document to start on a new page. They are just streams of text, my code calls are inserted into tables, but that's not where I need the page breaks.

Do you have an example?

Does the section always be on the report or depends on certain criteria?

Why your first part (before the page break) is a long multipage doc? What kind of data are you adding there? It's a table that overflows to the new page?

What do you mean with "They are just streams of text"?

It's always on the report, as I said, it's not something with programming logic (at least, I assume not), it's just a routine thing of wanting a page break for a new section of the document.

I tried:

<<START>>

(insert page break using Word menus)

<<END>>

in the document, but that doesn't work.

I tried this on a completely untagged 2-page document with two lines of text, so there is nothing complicated about the situation.

I would love to know how you got yours working, can you give me an example of your template code?

thanks

James

Top Labels in this Space