Skip to content
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

When a word document is opened, reading the file will fail #80

Open
zhangayndou opened this issue Aug 29, 2022 · 3 comments
Open

When a word document is opened, reading the file will fail #80

zhangayndou opened this issue Aug 29, 2022 · 3 comments

Comments

@zhangayndou
Copy link

Describe the bug
When a word document is opened, reading the file will fail

@amiremohamadi
Copy link
Owner

can you attach an example to this issue?

@zhangayndou
Copy link
Author

For example, I open a document named "test. Docx" in office, and then I started to run the test code to read the contents of the document, but nothing was read and printed,The test code is as follows:

duckx::Document doc("D:\\test.docx");
doc.open();
std::ostringstream ss;
for (duckx::Paragraph p = doc.paragraphs(); p.has_next(); p.next()) {
    for (duckx::Run r = p.runs(); r.has_next(); r.next()) {
        printf("content=%s\n", r.get_text().c_str());
    }
}

@amiremohamadi
Copy link
Owner

amiremohamadi commented Sep 2, 2022

make sure that the file exists on that path.
duckx's current API is not really good in handling errors, so please try this to make sure you're entering the path correctly:

  ofstream file("D:\\test.docx");;
  std::cout << file.is_open() << std::endl;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants