PANIC when reading an Excel file in which the button text is set to a string with newlines.
i-poper opened this issue · comments
PANIC when reading an Excel file in which the button text is set to a string with newlines.
Reproduction
Environment
item | ver |
---|---|
rust | 1.78 |
umya-spreadsheet | 1.2.6 |
Microsoft Excel | 2010 |
Code
fn main() {
let path = std::path::Path::new("./test.xlsx");
let _book = umya_spreadsheet::reader::xlsx::read(path).unwrap();
}
Excel file
Error log
thread 'main' panicked at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\structs\vml\text_box.rs:51:9:
Error at position 1054: EndEventMismatch { expected: "br", found: "font" }
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
1: core::panicking::panic_fmt
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72
2: umya_spreadsheet::structs::vml::text_box::TextBox::set_attributes<std::io::cursor::Cursor<ref$<alloc::vec::Vec<u8,alloc::alloc::Global> > > >
at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\structs\vml\text_box.rs:51
3: umya_spreadsheet::structs::vml::shape::Shape::set_attributes<std::io::cursor::Cursor<ref$<alloc::vec::Vec<u8,alloc::alloc::Global> > > >
at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\structs\vml\shape.rs:277
4: umya_spreadsheet::reader::xlsx::vml_drawing::read
at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\reader\xlsx\vml_drawing.rs:28
5: umya_spreadsheet::reader::xlsx::raw_to_deserialize_by_worksheet
at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\reader\xlsx.rs:207
6: umya_spreadsheet::structs::spreadsheet::Spreadsheet::read_sheet_collection
at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\structs\spreadsheet.rs:366
7: umya_spreadsheet::reader::xlsx::read_reader<std::fs::File>
at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\reader\xlsx.rs:124
8: umya_spreadsheet::reader::xlsx::read<ref$<std::path::Path> >
at C:\Users\i-poper\.cargo\registry\src\index.crates.io-6f17d22bba15001f\umya-spreadsheet-1.2.7\src\reader\xlsx.rs:142
9: umya_spreadsheet::main
at .\src\main.rs:3
10: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\ops\function.rs:250
11: core::hint::black_box
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\hint.rs:337
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\umya-spreadsheet.exe` (exit code: 101)
Note
Looking at xl/drawings/vmlDrawing1.vml
in test.xlsx
, the button description is as follows.
<v:textbox style='mso-direction-alt:auto' o:singleclick="f">
<div style='text-align:center'><font face="MS Pゴシック" size="220"
color="#000000">Button<br>
1</font></div>
</v:textbox>
The newlines are converted to <br>
and there is no </br>
, so the interpretation of xml seems to have resulted in an error.
The latest version is now available.
This version resolves the import error, but does not support form controls,
Form controls are not supported.
(They are lost when writing.)
Support for form controls will be considered in the next version.