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

Table content cut off on new page #205

Closed
albanotmakolli opened this issue May 30, 2020 · 11 comments
Closed

Table content cut off on new page #205

albanotmakolli opened this issue May 30, 2020 · 11 comments

Comments

@albanotmakolli
Copy link

When the content of a cell spans to another page the text is cutoff on the first and then the rest of it is rendered on the second page.

@philprime
Copy link
Member

hi there, this is actually on purpose, this feature is inspired by Apple Pages.
Would you prefer a break instead?

@albanotmakolli
Copy link
Author

Yes, a break would work better in my case. How can I set it to break? Thank you

@philprime
Copy link
Member

as of now this is not built-in (anymore) as I didn't have a use-case in combination with merged cells.

So how should it work with merged cells, move all rows with cut off cells to a new page?
How would you solve the following edge case:

image

This is the current sample in the "experiment" example, if you want to check it out yourself.

Also can you provide me an example for reproducing your use case, so I can use it as a reference?

@philprime
Copy link
Member

WIP is on branch feature/205-optional-table-cell-splicing

@StefaniOSApps
Copy link
Contributor

I also noticed this problem. It seems some time to exist. In an earlier version 1.6.X this worked without problems. Here you can see how the table covers the footer right. The branch you described was used here.

IMG_B84E6B01AAED-1

@philprime
Copy link
Member

@StefaniOSApps this is looks like a bug, so this needs to be investigated for sure, looks like the content height is not correct.

Let me give you an insight why I changed the table behavior in 2.X.X:

First I wanted merged cells, but therefore I wanted to provide a easier table access, which should also be more Swift(y). That's why I added the subscript mechanism for content/alignment management and also the merge() function.

Now merging cells is actually pretty straight forward:

  • Cells are class instances and the table is a 2D-Array which holds either pointers to the cells or nil if empty
  • When merging two cells, all values (for the given indicies) are set to the same instance.
  • During calculations the algorithm finds adjacent cells and combines their frames.
  • Now it iterates all calculated/merged cells, and filters them by page before rendering

Now I had one design issue to face: How to deal with merged cells at the page end?
Previously if a cell was too long for the page, the whole row was moved to the next page.

But now how should we handle the case when a single cell can span multiple rows?
What if every cell in the row has different spanning (see my previous image)?

As Apple Pages has always been a reference to me, I decided to "break" table cut off at page end, and duplicate the last cells and mask it away, just like Pages does. That's the behavior you can currently see.

We can adapt the algorithm as we desire, but the behavior should be determined before hand.
How would you solve this problem?

Anyway, thank you for starting this discussion!

@philprime
Copy link
Member

There is now a WIP and a PR #223 about this issue.
I implemented the flag and it works for my test case.
I am now looking into #205, which is the same use case but with headers on every page.

@zhxf2012
Copy link

The same case, @albanotmakolli @philprime . Maybe there can be a bool config for choose to add break or left to cut off. Only cut off with text content is strange for end users.

@icarus31
Copy link

@philprime, I tried you feature/205 branch and it fixed my issue with cut table cell. Super!

When you say "I am now looking into #205, which is the same use case but with headers on every page.", do you mean you will also fix the issue where the table header on the second page hides the first table cells?

@philprime
Copy link
Member

I am releasing the current progress so we can have smaller iterations fixing the table implementation.

As mentioned in #246, table headers on every page are still struggling, but the cut-off should be disabled now

philprime pushed a commit that referenced this issue Dec 5, 2020
* Added support for omitting first sliced cells
* Added page breaking without table cell slicing
* Added macOS support to tests
* Fixed test cases per OS
@philprime
Copy link
Member

Alright this has been merged and released in 2.3.2
If this error still occurs for you, please reopen, or if it differs create a new issue

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

5 participants