-
Notifications
You must be signed in to change notification settings - Fork 4
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
Read Cell Format (e.g. column width) #7
Comments
Adding the feature to read Cols is a significant task, involving rewriting the storage structure and updating the APIs. It may take considerable time. Luckily, I've found it closely related to issue #6, potentially allowing simultaneous resolution. |
Do you plan this for v0.4 ? |
Just to let you know: |
I can see your confusion because I didn't elaborate on the method. In fact, |
Hmm. I simply tested
i.e. the unmodified sheet, in the original example. And this does work. Yep. It's rather weird that modified values should be seen while "original" values from the xlsx file are not. |
Yes, the default width is hidden in office 365 and |
I am looking forward to testing any intermediate state of the project ... and finally some beautiful final release. |
I've released version 0.4.1 which provides reading text and styles, you can see the usage in examples/read_and_copy. |
I cloned the new main from github and locally modified the I do see the
Edit Yep this seems to work. |
I now can collect the column widths. But what exactly is the in your example this is "A:A" / "C:L" / "B:B" (in this sequence) I would need the numerical value of the column position. Supposedly I can extract it from the string. Is there any function or documentation to do that ? ( In fact a Location or similar type in that place seems more appropriate. Later.... |
Yep. works with Range and |
I use string as the key of the result map because string can be used as an input into for col in 1..16384 {
let cols = worksheet.get_columns_width((1, col, 1, col))?;
let customed_col = cols.values().last();
let width = match customed_col {
Some(Some(w)) => *w,
_ => worksheet.get_default_column(),
};
println!("{width}");
} The good news is that this method is not completely unacceptable due to the maximum width limit of xlsx (16384) and the fact that the time complexity of the method (logn) is not very high. |
Yes, this method is meant to do the conversion between string and numeric forms of the column IDs, but it's meant to work only for the project itself (and it does look like you're working on a complex project) |
My intention is to allow users to modify them without side effects after using I reread excelfileformat and focused on the definition of default column widths, which is determined by fonts when they don't exist in the xlsx file, but the documentation doesn't define the method column widths are calculated from fonts |
In fact with my example, the default column with is perfectly provided by your function. I only did not interpret the result appropriately. |
With version 0.4 I was able to read the cell content (as a
string
)After setting
fill
andfg_color
andbg_color
in formats.rs and color.rs to generalpub
, I do get some seemingly sensible value for the foreground color (asRGB
as aString
) . 👍 👍 👍To display the table or convert it in some other file format I need the column width (row height would obviously also be of interest)
I found that the
cols
vector does not yet get filled with data from the xlsx file and hence the column widths are unknown.(Of course to be usable the appropriate values need to get published by
pub
declarations or get_..() functions. )The text was updated successfully, but these errors were encountered: