-
Notifications
You must be signed in to change notification settings - Fork 253
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
Rotate text for table header #1140
Comments
Hi @Tomnl Thank you for reaching out and suggesting this feature. I think it could be a handy addition. Regarding how this feature would operate, I'm not sure that In order to build the final table-related feature, a first "building-block" would be to be able to render some text block (with Also, we actually have too few unit tests regarding the rotation of text content, i.e. combining |
Thanks for the quick reply @Lucas-C.
I agree that seems to be the logical place to add it
So am I correct in thinking that within the
Not sure how much help I can bring. But maybe I can contribute a unit test first to help me understand the code base a bit better and then see what I could contribute! |
Yes, I think that could be handy.
Yes, that would be the simplest way to implement it, and I do not see any issue with using this approach.
That would be very welcome! 🙂 |
I fully agree: we can start with a basic (limited) implementation for now, but keep in mind how it could be generalized later on 😊 |
Hi @Tomnl We have given lengthy answers, I hope they did not discourage you to contribute a PR to Are you still willing to work on this feature? |
Closing this issue for now. |
Hi @Lucas-C and @gmischler ; I stumbled across this issue when I was trying to do exactly what @Tomnl was suggesting - rotating table headers vertically. I deal very often with data where the column/field names are quite long, but the data itself is quite short, sometimes only a single character (e.g. a boolean.) Being able to effectively narrow a column to the maximum data width rather than the field name would be very helpful in making tables that fit on a single page of width. I would be very interested in this feature, and I saw your suggestions to @Tomnl about possibly how to implement it and submit a PR. I'd like to give it a go. However... I haven't contributed much to projects before, and I'm quite unfamiliar with this project in particular. I work a lot with pandas and sqlite and matplotlib - dealing with generating PDFs is new for me, so I might be a bit slow (well, very slow) and need a bit of handholding with how to submit a PR that's appropriate and useful. I think it would be best to narrow the scope to start - maybe restrict the rotation angle to ± 90º, and rotate the entire block of text, not each individual character. But, for the future, let's take in two parameters: angle, rot_style. Angle is a float (default 0.0), rot_style a string. rot_style would (eventually) accept either 'all' (the default) or 'by_char' (as some Asian scripts are supposed to be rendered.) Probably these parameters would be passed as arguments to Row.cell() or Table.row() Let me know if you would still be interested in adding this, if I was able to do some of the work. |
Sorry for the delay in answering you @NickFabry 😢
That's great!
That's perfectly fine for us in the maintainers team, as long as you are not in a urge to get feedbacks / you PR merged,
It's good to discuss the API / interface beforehand.
Yes! 👍 |
Hi @Lucas-C - sorry for the long delay getting back. This is a 'keep alive' reply - I'm hoping I can make a go of this in mid-October; I have some known time free then. In the meanwhile - thanks for reopening this idea! |
I would like to contribute to this specific issue and project as well, kindly let me know if i could be any help |
Hi @NickFabry It's mid-october, so I was wondering if you were still planning to tackle this issue? 🙂 |
...yes. But it won't be mid-October! I got a ton of work this week. So... another keep-alive post. I'll need a couple of free days to sit down, think about the API seriously and learn where and how to poke things. If it becomes completely infeasible for me to do, I'll reach out explicitly and let you know so you're not waiting forever. Thanks for your patience! |
Please explain your intent
I would like to rotate text for a table header. In particular, have the heading text rotated so that it vertical in the table.
As far as I can tell this not currently possible.
Describe the solution you'd like
When using the
pdf.table
functionality as described in the docs, it would be great if there was a way to rotate the text in the cells (particulary for the table header).Wishful thinking... but perhaps defined something like this
I have looked into using the
pdf.rotation
approach described here but it does not seem compatible withpdf.table
e.g. the following
row.cell
will not be changed by the pdf.rotation (and would be difficult to know the x and y coordinates to use anyway)Additional context
See below for example format (not produced by fpdf2) to clarify the format I am referring to.
ref
The text was updated successfully, but these errors were encountered: