Welcome Guest Search | Active Topics | Sign In | Register

Eo.Pdf Dyanmic table sizing based on column count Options
Bboucher
Posted: Tuesday, October 10, 2017 4:26:06 PM
Rank: Newbie
Groups: Member

Joined: 10/10/2017
Posts: 4
I am having an issue. Im trying to create a pdf. The amount of columns is dynamic, so i need to the table and context of the cells to shrink accordingly based on how many columns can fit

right now im getting a column count and im dividing by the set width of a normal landscape pdf (float 11)

no matter what, the last column is always squished while all others are taking up a good amount of space.

nothing sizes evenly.

any way to get the column to size accordingly or ensure word wrap so the text doesn't cross into other cells? auto size only allows 1 column (for some unknown reason)
eo_support
Posted: Wednesday, October 11, 2017 10:12:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Which interface do you use? Do you use HTML to PDF or use AcmTable? And how do you calculate and apply the width of each column?

Thanks!
Bboucher
Posted: Wednesday, October 11, 2017 10:22:25 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2017
Posts: 4
Hello,

I'm using the AcmTable.

var columnCt = dt.Columns.Count;
const float standardWidth = 12f - .12f; //standard width for a page rotated minus padding
const float height = 8.5f; //standard height for a page rotated

float columnWidth = standardWidth/columnCt;

List<float> widths = new List<float>();

for (int i = 0; i < columnCt; i++)
{
widths.Add(columnWidth);
}

this works for around 10 columns. If my column count increases to 12 columns, again, the columns don't size accordingly.

Also, text will cross into other cells. I have tried using ....

AcmTableCell cell = new AcmTableCell();
cell.Style.HorizontalAlign = AcmHorizontalAlign.Center;
cell.Style.Margin = new AcmPadding(0.2f);
cell.Style.Padding = new AcmPadding(0.2f);
cell.Style.OffsetY = 0.2f;
cell.Style.OffsetX = 0.2f;

as well as the margin, padding, offsety and offsetx in an AcmStyle, and attaching it to a sheet and adding the sheet to the AcmContent

none of that causes the word wrap to occur.
eo_support
Posted: Tuesday, October 17, 2017 3:54:51 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Sorry about the late replying. We have tested it here and everything seems to work fine. As to possible issues:

1. Margins may affects the last few columns. By default the AcmRender has a margin of one inch on both sides. So if your paper width is 12 inches, unless you have explicitly set the margin, the usable width will only be 10 inches. If you have assumed more than 10 inches when you calculate your column layout, then the last few columns may be cut off;

2. Words will cross into the next cell if there isn't enough space. If a word is too long, it will be wrapped to the next line. However if the whole column width is not wide enough to fit the whole word, the word will cross into the next cell. In another word, word-wrapping only occurs in between word, not in the middle of a word;

Please let us know if this is your case. If this is not your case, you can create a small test project demonstrating the problem and we will be happy to investigate further. See here for more details on how to send test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
Bboucher
Posted: Tuesday, October 17, 2017 3:58:45 PM
Rank: Newbie
Groups: Member

Joined: 10/10/2017
Posts: 4
eo_support wrote:
Hi,

Sorry about the late replying. We have tested it here and everything seems to work fine. As to possible issues:

1. Margins may affects the last few columns. By default the AcmRender has a margin of one inch on both sides. So if your paper width is 12 inches, unless you have explicitly set the margin, the usable width will only be 10 inches. If you have assumed more than 10 inches when you calculate your column layout, then the last few columns may be cut off;

2. Words will cross into the next cell if there isn't enough space. If a word is too long, it will be wrapped to the next line. However if the whole column width is not wide enough to fit the whole word, the word will cross into the next cell. In another word, word-wrapping only occurs in between word, not in the middle of a word;

Please let us know if this is your case. If this is not your case, you can create a small test project demonstrating the problem and we will be happy to investigate further. See here for more details on how to send test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!


you nailed it on both accounts.

After playing around i found better luck after setting the margins (as you pointed out the reason to why in step 1)

as to #2, is there a way to force the cell to recognize to large of a word for it, and break the word with a space so it wraps accordingly?
eo_support
Posted: Tuesday, October 17, 2017 4:41:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Unfortunately no. We do not have any plan to support this. The reason is we have two set of interface: ACM interface and HTML to PDF interface. ACM interface is designed to simple and fast, where as HTML to PDF interface is designed to be powerful but slower. So the basic guideline here is if there is something that is overly complicated for the ACM interface to do, then we would leave it to the HTML to PDF interface.

Word breaking in the middle of word would fall into this category. It can be easily achieved by overflow-wrap: break-word CSS property. So if you do need this feature, I would recommend you using the HTML to PDF interface instead.

Thanks!

Bboucher
Posted: Tuesday, October 17, 2017 4:56:30 PM
Rank: Newbie
Groups: Member

Joined: 10/10/2017
Posts: 4
eo_support wrote:
Hi,

Unfortunately no. We do not have any plan to support this. The reason is we have two set of interface: ACM interface and HTML to PDF interface. ACM interface is designed to simple and fast, where as HTML to PDF interface is designed to be powerful but slower. So the basic guideline here is if there is something that is overly complicated for the ACM interface to do, then we would leave it to the HTML to PDF interface.

Word breaking in the middle of word would fall into this category. It can be easily achieved by overflow-wrap: break-word CSS property. So if you do need this feature, I would recommend you using the HTML to PDF interface instead.

Thanks!



Thank you very much for your assistance. The information you have provided me was extremely useful!
eo_support
Posted: Tuesday, October 17, 2017 5:04:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
You are very welcome. Please feel free to let us know if you run into anything else.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.