We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

C++ Code to Get Page Count of Word File containing Chinese Text | Set Default Editing Language to Chinese PRC | Stack Overflow

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.

@awais.hafeez

A month has passed.
Any news?
Thanks.

@kngstr,

If everything goes by plan then the fix of WORDSCPP-995 will be integrated in the next 20.9 version of Aspose.Words for C++. In the meantime you can increase stack size as a workaround. We will notify you here when 20.9 version of Aspose.Words for C++ will be released.

@awais.hafeez

Thanks.
Since my license was expired.
Can I get some hotfixes for this bug?
The last version I can use is Aspose.Words for C++ 20.7.
Can I get fixes for this version?

@kngstr,

Please note that we do not provide support for older released versions of Aspose.Words. We also do not provide any fixes or patches for old versions of Aspose APIs. All fixes and new features are always added into new versions of our APIs. So, the only solution would be to renew your subscription and upgrade to the latest version of Aspose.Words. You can also request a 30-day Temporary License to verify the correctness of Apsose.Words 20.9 on your end. Please refer to How to get a Temporary License?.

@awais.hafeez

Thanks for your answer.
Since this is a bug, so I ask for fix.
This is not new ability.
And .Net SDK is much better than C++ SDK .
Renew is only when this SDK to be stable in the future.
If only renew is available, it’s so sorry for your attitude.

@kngstr,

I am afraid, according to the company policy of Aspose, we are unable to integrate bug fixes in older versions of Aspose APIs. In your case, we will add the fix of WORDSCPP-995 in next 20.9 version of Aspose.Words for C++. Also, license files contain a subscription expiry date and you can check subscription expiry date of your license to determine if you will be eligible to use 20.9 version after when it will be released (most likely) during this month.

If you find any further questions/concerns related to licensing, I suggest you please post your query in Aspose.Purchase forum where our sales team will guide you appropriately.

@awais.hafeez

Thanks for you advice.
My license was expired a month ago.
I’ll to ty query purchase form.

@awais.hafeez

Thanks.
I queried purchase forum.
No need hotfixes.
I can get fixed version.

@kngstr,

It is to update you that the issue you had found earlier (filed as WORDSCPP-995) has now been fixed in this Aspose.Words for C++ 20.9 release.