Free Support Forum - aspose.com

Word file reading error using C++

Hi,

I’m using Words for C++ 20.7.
Trying to load this file, and got to STACK OVERFLOW

I want to get page count of this file, but I got 235 and STACK OVERFLOW.
I tried office and wps, it’s 172 and 175.

stack_overflow.zip (356.6 KB)

@kngstr,

Setting the Default Editing Language to ChinesePRC returns the correct (174) number of pages from the DOCX file you shared. Please try the following C++ code:

#include <iostream>
#include <system/io/file.h>
#include <system/smart_ptr.h> // For System::MakeObject<T>()

#include <Aspose.Words.Cpp/Licensing/License.h>
#include <Aspose.Words.Cpp/Model/Document/Document.h>
#include <Aspose.Words.Cpp/Model/Document/LoadOptions.h>
#include <Aspose.Words.Cpp/Model/Document/LanguagePreferences.h>
#include <Aspose.Words.Cpp/Model/Document/EditingLanguage.h>

using namespace Aspose::Words;

int main()
{
	auto license = System::MakeObject<License>();
	System::SharedPtr<System::IO::Stream> stream = System::IO::File::OpenRead(u"E:\\Temp\\Aspose.Total.Product.Family.lic");
	license->SetLicense(stream);

	System::SharedPtr<LoadOptions> loadOptions = System::MakeObject<LoadOptions>();
	loadOptions->get_LanguagePreferences()->set_DefaultEditingLanguage(EditingLanguage::ChinesePRC);

	System::SharedPtr<Document> doc = System::MakeObject<Document>(u"E:\\Temp\\stack_overflow\\stack_overflow.docx", loadOptions);
	std::cout << doc->get_PageCount() << "\n";

	std::cout << "End!\n";
}

@awais.hafeez

Thanks. It works.
But the STACK OVERFLOW still exist.

@awais.hafeez

I tested this bug more, and found that after STACK OVERFLOW I can not do anything with this SDK.
Then I got this error message: device or resource busy: device or resource busy

@kngstr,

To address this problem, we have logged it in our issue tracking system with ID WORDSCPP-995. We will further look into the details of this problem and will keep you updated here on the status of the linked issue.

@awais.hafeez

My license is going to be expiried.
Since this is bug of SDK.
Can I get fixes or something else?

Thanks

@kngstr,

I am afraid, we have not started analyzing the root cause of this problem yet. We will inform you here as soon as this issue will get resolved in future or any further updates may be available. We apologize for any inconvenience.

@awais.hafeez

OK, Thanks.

@awais.hafeez

Any news?
Will I get some fixes for 20.7?
Thanks.

@kngstr,

I am afraid, WORDSCPP-995 is currently pending for analysis and is in the queue. We will inform you via this forum thread as soon as this issue will get resolved in future or any more updates may be available. We apologize for any inconvenience.

@awais.hafeez

OK. Thanks.