-
Notifications
You must be signed in to change notification settings - Fork 142
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 cell widths ignored? #123
Comments
I gather that this is somewhere between code and pseudocode, but before we dive in too deep, your example above uses the variable Is that a function of how you translated/presented the code in the issue description, or is it possible you are passing a |
Yes, just corrected the example. Ideally, I'd like to be able to specify a pct width without needing to calculate... |
This pull request might be related: #115 . It allows to set column widths, but does not support percentages. Without this patch caracal "auto-calculates" column widths from the first row. If you specify cell width in a row other than first row, it will be ignored. |
@martinsp Your pull request is probably related. The issue with my table is a header row with colspan: 2 or 3. That seems to be the precipitating problem. I'm going to try a few things in caracal-example to test your theory. |
Here's a replicable example (inserted into caracal-example doc):
This generates a table with a header row and then two "equal width" columns... Yikes! |
Table cell widths seem to be accepted but ignored in modern versions of Word (16.25 for Mac and current Word on Windows 10. When I open a docx with Pages or Open Office, it seems to be respecting the twips-based cell widths, but in Word it seems to default to just auto-width even when twips are given.
I'm trying to get percentage width columns so I'm effectively going with:
container_width = docx.page_width - docx.page_margin_left - docx.page_margin_right
col_width = container_width / 3
and then
cell = Caracal::Core::Models::TableCellModel.new do |cell|
cell.width col_width
cell.h4 "Direct Reports"
end
Any hints? Do I need to do the calculation differently?
The text was updated successfully, but these errors were encountered: