Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
This page outlines how to convert a Word document to Excel format (XLS/XLSX) using Aspose.Words.
Converting documents from one format to another is the flagship feature of Aspose.Words. You can convert documents in any available load format also to XLSX format.
Converting a document to XLSX is a rather complicated process. To save your document to XLSX format using Aspose.Words, use the XlsxSaveOptions class and the new Xlsx element in the SaveFormat enumeration. As mentioned above, you can save the document in any load format supported by Aspose.Words to XLSX.
The following code example shows how to save DOCX to XLSX:
Also using Aspose.Words, you can find a specific string or regular expression in your document and replace it with the matching one you need. Then you can also save the result to XLSX format.
The following code example shows how to perform find and replace operation and save result to XLSX:
You can also specify the compression level when saving using the get_CompressionLevel() property.
The following code example shows how to specify the compression level when saving to XLSX format:
Q: How can I convert a DOCX document to Excel (XLSX) using Aspose.Words for C++?
A: Load the DOCX with the Document class and call Save specifying an XLSX file name. Aspose.Words automatically detects the source format and writes the spreadsheet. Example:
auto doc = MakeObject<Document>(MyDir + u"Document.docx");
doc->Save(ArtifactsDir + u"Result.xlsx");
Q: Can I perform find‑and‑replace on a document before saving it as Excel?
A: Yes. Use FindReplaceOptions together with Range::Replace to modify the document content, then save the updated document to XLSX. The same code shown in the “Find and Replace When Saving to XLSX” section applies.
Q: How do I control the compression level of the generated XLSX file?
A: Create an XlsxSaveOptions instance, set its CompressionLevel property (e.g., CompressionLevel::Maximum), and pass the options to Document::Save. This reduces file size at the cost of longer save time.
Q: Do I need a license to convert documents to Excel, and how do I apply it in C++?
A: A license is required for production use to remove evaluation watermarks and enable full functionality. Load the license file with the License class before any document operations:
auto license = MakeObject<License>();
license->SetLicense(u"Path/To/Aspose.Words.CPP.lic");
After setting the license, all conversion features work without restrictions.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.