You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::fs::File;use std::io::prelude::*;use docx_rs::*;fnmain(){let docx = hello_docx().unwrap();println!("{:?}", docx);}pubfnhello_docx() -> Result<Docx,ReaderError>{// My original docx file generates an error when using read_docx to read it.let filename = String::from("docx-rs.docx");// The file is named docx-rs.docx, // which was opened with LibreOffice and saved as docx-rs01.docx. // When using read_docx on this modified file, it works fine. // I suspect that there might be some issue with the original file // that prevents it from being read properly. // However, the error message does not provide enough information // for me to pinpoint the exact cause of the problem.let filename = String::from("docx-rs01.docx");let contents = read_file_contents(&filename).unwrap();let docx = docx_rs::read_docx(&contents).unwrap();Ok(docx)}pubfnread_file_contents(filename:&str) -> Result<Vec<u8>, std::io::Error>{letmut contents = vec![];// let mut f = File::open(filename)?;letmut f:File = File::open(filename)?;let size = f.read_to_end(&mut contents).unwrap();println!("size: {}", size);Ok(contents)}
And Then, the error log
> RUST_BACKTRACE=full cargo run
Finished dev [unoptimized + debuginfo]target(s) in 0.01s
Running `target/debug/docx`
size:666042
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:NumError(ParseIntError{kind:InvalidDigit})', src/main.rs:16:46
stack backtrace:0:0x55c2fa128ae1 - std::backtrace_rs::backtrace::libunwind::trace::he648b5c8dd376705
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:51:0x55c2fa128ae1 - std::backtrace_rs::backtrace::trace_unsynchronized::h5da3e203eef39e9f
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/../../backtrace/src/backtrace/mod.rs:66:52:0x55c2fa128ae1 - std::sys_common::backtrace::_print_fmt::h8d28d3f20588ae4c
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:65:53:0x55c2fa128ae1 - <std::sys_common::backtrace::_print::DisplayBacktraceas core::fmt::Display>::fmt::hd9a5b0c9c6b058c0
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:44:224:0x55c2fa1501ef - core::fmt::rt::Argument::fmt::h0afc04119f252b53
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/fmt/rt.rs:138:95:0x55c2fa1501ef - core::fmt::write::h50b1b3e73851a6fe
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/fmt/mod.rs:1094:216:0x55c2fa126167 - std::io::Write::write_fmt::h184eaf275e4484f0
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/io/mod.rs:1714:157:0x55c2fa1288f5 - std::sys_common::backtrace::_print::hf58c3a5a25090e71
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:47:58:0x55c2fa1288f5 - std::sys_common::backtrace::print::hb9cf0a7c7f077819
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:34:99:0x55c2fa129e23 - std::panicking::default_hook::{{closure}}::h066adb2e3f3e2c07
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:269:2210:0x55c2fa129bb4 - std::panicking::default_hook::h277fa2776900ff14
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:288:911:0x55c2fa12a3a9 - std::panicking::rust_panic_with_hook::hceaf38da6d9db792
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:705:1312:0x55c2fa12a2a7 - std::panicking::begin_panic_handler::{{closure}}::h2bce3ed2516af7df
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:597:1313:0x55c2fa128f46 - std::sys_common::backtrace::__rust_end_short_backtrace::h090f3faf8f98a395
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:151:1814:0x55c2fa129ff2 - rust_begin_unwind
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:515:0x55c2f9d5e813 - core::panicking::panic_fmt::h4ec8274704d163a3
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:1416:0x55c2f9d5eda3 - core::result::unwrap_failed::h170bc2721a6c6ff2
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:517:0x55c2f9d5f1f6 - core::result::Result<T,E>::unwrap::he5e2a27e7ecab222
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1076:2318:0x55c2f9d5f4ae - docx::hello_docx::he7c9326a24b51d85
at /home/ice/projects/gino/ginodocx/docx/src/main.rs:16:1619:0x55c2f9d5f268 - docx::main::hd6500f5418777136
at /home/ice/projects/gino/ginodocx/docx/src/main.rs:6:1620:0x55c2f9d5fb8b - core::ops::function::FnOnce::call_once::h0d7c07ebf870a78a
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:521:0x55c2f9d5f96e - std::sys_common::backtrace::__rust_begin_short_backtrace::hedf86b2bde00af48
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:135:1822:0x55c2f9d5f941 - std::rt::lang_start::{{closure}}::h9ad352a056f790f6
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:166:1823:0x55c2fa122e7b - core::ops::function::impls::<impl core::ops::function::FnOnce<A>for&F>::call_once::h75ba4244a1c7bb54
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:284:1324:0x55c2fa122e7b - std::panicking::try::do_call::h0a2baa36dea975a1
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:4025:0x55c2fa122e7b - std::panicking::try::h0e42aa233d4224d4
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:1926:0x55c2fa122e7b - std::panic::catch_unwind::hefdfd8f482606434
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:1427:0x55c2fa122e7b - std::rt::lang_start_internal::{{closure}}::h457959f0f91da23b
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148:4828:0x55c2fa122e7b - std::panicking::try::do_call::h112cfd1acb38183b
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:4029:0x55c2fa122e7b - std::panicking::try::ha64f15b20cec18ca
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:1930:0x55c2fa122e7b - std::panic::catch_unwind::hbacc2b68ee2c119e
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:1431:0x55c2fa122e7b - std::rt::lang_start_internal::h5f408694586c2a05
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148:2032:0x55c2f9d5f91a - std::rt::lang_start::hc3d2ea738feb8cee
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:165:1733:0x55c2f9d5f7ee - main
34:0x7fe582223510 - __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:1635:0x7fe5822235c9 - __libc_start_main_impl
at ./csu/../csu/libc-start.c:381:336:0x55c2f9d5f0a5 - _start
37:0x0 - <unknown>
A clear and concise description of what the bug is.
Reproduced step
Steps to reproduce the behavior:
RUST_BACKTRACE=full cargo run
Expected behavior
read the docx file well
Actual behavior
thread 'main' panicked at 'called Result::unwrap() on an Err value: NumError(ParseIntError { kind: InvalidDigit })', src/main.rs:16:46
OS: [e.g. iOS]
Linux version 6.2.0-35-generic (buildd@bos03-amd64-016) (x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu122.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) fix: add abstract numbering and numbering #3522.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 6 10:23:26 UTC 2
[package]
name = "docx"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
docx-rs = "0.4.7"
The text was updated successfully, but these errors were encountered:
There is already a pull request that fixes this bug. #35 I hope it gets published on crates.io soon.
It's work well:
Cargo.toml
[package]
name = "docx"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
# docx-rs = "0.4.7"docx-rs = { git = "https://github.com/bokuweb/docx-rs", branch = "main" }
Describe the bug
And Then, the error log
A clear and concise description of what the bug is.
Reproduced step
Steps to reproduce the behavior:
RUST_BACKTRACE=full cargo run
Expected behavior
read the docx file well
Actual behavior
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: NumError(ParseIntError { kind: InvalidDigit })', src/main.rs:16:46OS: [e.g. iOS]
Linux version 6.2.0-35-generic (buildd@bos03-amd64-016) (x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1
22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) fix: add abstract numbering and numbering #3522.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 6 10:23:26 UTC 2Version [e.g. 22]
rustc 1.72.0 (5680fa18f 2023-08-23)
cargo 1.72.0 (103a7ff2e 2023-08-15)
Cargo.toml
The text was updated successfully, but these errors were encountered: