MortalreminderPT / edit-xlsx

A quick and easy-to-use Rust library for Excel file editing.
https://crates.io/crates/edit-xlsx
16 stars 4 forks source link

The default colomn width does not seem to be correct #13

Closed mschnell1 closed 2 months ago

mschnell1 commented 2 months ago

In my example I get None for an unmodified column, while the previous column is much smaller and for same I get 4.0 as a non-default width. At the moment I use a "default" width of 0 for the converted adoc file, which means: "have the text fit in the field if possible" which kind of makes sense, but in act I would like to have the excel file be a kind of "WYSIWYG" for the adoc, hence I would need to have the correct relative display width of "default" width columns.

MortalreminderPT commented 2 months ago

It should not be possible, I explained the reason for not being able to calculate the exact value of the default width in issue 7. This means that even if different users open the same xlsx file, they may get different default widths.

mschnell1 commented 2 months ago

I see. Weird stuff.

mschnell1 commented 2 months ago

@MortalreminderPT

I explained the reason for not being able to calculate the exact value of the default width in issue 7. This means that even if different users open the same xlsx file, they may get different default widths.

Maybe the intention in Excel even is similar to what AsciiDoctor does: determine the text width (by using the fornts) top have it fit.

Hence my intuition resulted in the best possible solution.

MortalreminderPT commented 2 months ago

@MortalreminderPT

I explained the reason for not being able to calculate the exact value of the default width in issue 7. This means that even if different users open the same xlsx file, they may get different default widths.

Maybe the intention in Excel even is similar to what AsciiDoctor does: determine the text width (by using the fornts) top have it fit.

Hence my intuition resulted in the best possible solution.

So I recommend that you write your own code to populate the missing default column width, which you can use to calculate based on formatfont and other fields.

mschnell1 commented 2 months ago

I don't see how a decent value for the default width could be calculated. ADOC only seems to use the relations between the column width values and not the absolute values, anyway. "0" sems to mean that ADOC should estimate the width of that column, according tho the text content. So I use "0" as a default for the default, which kind of makes sense and seems to work rather well.

mschnell1 commented 2 months ago

Just for the record: When converting ADOC to PDF using asciidoctor-pdf. "0" as default column width does not seem to work. I now set it to a small positive value as a workaround.