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

Is there a way to create fixed height container? #828

Open
Vamp808 opened this issue Mar 31, 2024 · 2 comments
Open

Is there a way to create fixed height container? #828

Vamp808 opened this issue Mar 31, 2024 · 2 comments

Comments

@Vamp808
Copy link

Vamp808 commented Mar 31, 2024

Lets say we have a container "ex. cell" that has specific dimension, and we want to put a text that is bigger than the cell dimension ,
normally, putting the bigger text inside cell will make the cell height to expand until it contains all the text,
in (iTextSharp) if I set this cell height as (Fixed Height), only part of the text (that the cell height can handle) will show, the remaining text will not show , and the cell height will not expand , see the image:

img

I tried (MaxHeight) without success, it throws exception.

so how can I achieve this in QuestPdf?

@MercinaM
Copy link

MercinaM commented Apr 8, 2024

You should be able to achieve what you want by using a combination of MaxHeight and StopPaging. You may also need WrapAnywhere for results to show the last partial word ("hav"), but that will only work correctly if are rendering a single line of text; with 2 lines or more, I believe WrapAnywhere will cause words to break in lines 1 and 2 as well, which is probably not something you want.

There is a discussion around this topic in #742, and from what I gather future versions (after 2024.3.0) may offer better support for text truncation.

@MarcinZiabek
Copy link
Member

Indeed, the 2024.3.0-rc2 release allows you to set the maximum number of lines that should be visible. If text requires more space, it is truncated with the ellipsis symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants