Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact list: keep family all on one page #885

Closed
jefft opened this issue Mar 21, 2023 · 12 comments
Closed

Contact list: keep family all on one page #885

jefft opened this issue Mar 21, 2023 · 12 comments

Comments

@jefft
Copy link
Contributor

jefft commented Mar 21, 2023

In Families -> Contact List one can generate a church directory-style contact list, and then 'Download as..' DOCX.

It would be nice if family members could be kept together on a page, rather than being split on pagebreaks:

image

jefft added a commit to jefft/jethro-pmm that referenced this issue Mar 21, 2023
@jefft
Copy link
Contributor Author

jefft commented Mar 21, 2023

The PR improves this a bit by at least keeping each row together:

image

tbar0970 added a commit that referenced this issue Mar 21, 2023
#885: Don't let names or addresses be split across pagebreaks
@tbar0970
Copy link
Owner

PR is a good step in the right direction. Unfortunately solving this properly would be really tricky. The way we currently assemble the DOCX doesn't have any awareness of where the page breaks are. For my part I just manually break pages as required before printing.

@tim-pearce
Copy link
Contributor

The solution is to put the whole family within a table of just one cell then set the option to not split the table across page or column breaks. I can't find that option in Word 2010 but it honours the option when I create the document with Libreoffice.

Screenshot_2023-03-22_00-38-28

Attached are the two documents I feed into the document merge process.
Families2.docx
Families2.odt
The only 'fiddle' was to change the font size of the line after the table to 0 and reduce the font size of the last line inside the table by 1.

@tbar0970
Copy link
Owner

tbar0970 commented Mar 22, 2023

Attached are the two documents I feed into the document merge process.

Ah yes I can see this would work for a document merge. But this issue is actually talking about the "contact list" page which does merging differently, with more sophisticated layout per family.

The solution is to put the whole family within a table of just one cell then set the option to not split the table across page or column breaks. I can't find that option in Word 2010 but it honours the option when I create the document with Libreoffice.

The downside of this approach in the contact list, and the reason for not building it this way, was that by using nested tables you'd lose global control over the layout. If you decide you want the mobile column a bit wider, currently you can adjust it and every family is affected because it's one big table. If it was separate nested table for every family, you'd have to manually adjust every one separately.

@tbar0970
Copy link
Owner

@jefft When photos are included, there is a cell containing the photo which spans all the rows in the family. If cantSplit=true affects that cell, I think that will end up keeping the whole family together when photos are included.

@jefft
Copy link
Contributor Author

jefft commented Mar 22, 2023

@tbar0970 no, the photo cell is only in the first row. This is probably a separate bug:

image

image

@tbar0970
Copy link
Owner

Eww. Dunno what's happened there...

@tim-pearce
Copy link
Contributor

The solution is to put the whole family within a table of just one cell then set the option to not split the table across page or column breaks. I can't find that option in Word 2010 but it honours the option when I create the document with Libreoffice.

The downside of this approach in the contact list, and the reason for not building it this way, was that by using nested tables you'd lose global control over the layout. If you decide you want the mobile column a bit wider, currently you can adjust it and every family is affected because it's one big table. If it was separate nested table for every family, you'd have to manually adjust every one separately.

Would a solution to that be to have some parameters to the process that can specify things like column widths, borders and padding?

@jefft
Copy link
Contributor Author

jefft commented Mar 22, 2023

Would a solution to that be to have some parameters to the process that can specify things like column widths, borders and padding?

That probably is the only fix. There doesn't appear to be a way, in PHPWord, just to say "keep these table rows altogether".

Manually specifying widths would be a cure would be worse than the disease I reckon. IMO this is a "close can't fix" bug. Keeping row contents from being split fixes the most egregious symptom.

@tim-pearce
Copy link
Contributor

tim-pearce commented Mar 22, 2023

Document merge (or rather TinyButStrong which it uses) might provide a way.
I've been using 'simple'' blocks but it does allow for sub blocks. See https://www.tinybutstrong.com/manual.php#html_block_subblock
I had previously ruled it out for a contact list because I didn't think it could be used for sub-data.
Using TinyButStrong would allow 'shipping' of a standard template based on the current contact list but then be able to use your own template so it looks exactly as you want.

@tim-pearce
Copy link
Contributor

I am currently working on a 'use document template' feature for the contact list.
At present I have a modal box (similar to the one I have for rosters) and a document_merge_contacts call based on document_merge.
All a bit rough and incomplete at this point.

@tim-pearce
Copy link
Contributor

I've got it working. The code is pretty messy at present and I haven't figured out what to do about images - not sure if they are possible.

@tbar0970 tbar0970 reopened this Apr 17, 2024
@tbar0970 tbar0970 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants