Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Chuyển đổi tài liệu từ một định dạng sang định dạng khác là tính năng cơ bản của Aspose.Words. Bạn có thể chuyển đổi các tài liệu trong bất kỳ load format nào cũng sang định dạng XLSX.
Chuyển đổi một tài liệu sang XLSX là một quá trình khá phức tạp. Để lưu tài liệu của bạn ở định dạng XLSX bằng cách sử dụng Aspose.Words, hãy sử dụng lớp XlsxSaveOptions và phần tử mới Xlsx trong các SaveFormat này. Như đã đề cập ở trên, bạn có thể lưu tài liệu dưới bất kỳ định dạng nào được Aspose.Words hỗ trợ đến XLSX.
Ví dụ mã sau cho thấy cách lưu PDF sang XLSX:
Document doc = new Document(getMyDir() + "Pdf Document.pdf");
doc.save(getArtifactsDir() + "BaseConversions.PdfToXlsx.xlsx");Cũng sử dụng Aspose.Words có thể tìm thấy một chuỗi cụ thể hoặc biểu thức chính quy trong tài liệu của bạn và thay thế nó bằng điều phù hợp mà bạn cần. Sau đó bạn cũng có thể lưu kết quả ở định dạng XLSX.
Mã ví dụ sau cho thấy cách thực hiện thao tác tìm và thay thế và lưu kết quả đến XLSX:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("Ruby bought a ruby necklace.");
// We can use a "FindReplaceOptions" object to modify the find-and-replace process.
FindReplaceOptions options = new FindReplaceOptions();
// Set the "MatchCase" flag to "true" to apply case sensitivity while finding strings to replace.
// Set the "MatchCase" flag to "false" to ignore character case while searching for text to replace.
options.setMatchCase(true);
doc.getRange().replace("Ruby", "Jade", options);
doc.save(getArtifactsDir() + "BaseConversions.FindReplaceXlsx.xlsx");Bạn có thể chỉ định mức nén khi lưu bằng thuộc tính CompressionLevel.
Mã ví dụ dưới đây cho thấy cách để chỉ định mức nén khi lưu ở dạng XLSX:
Document doc = new Document(getMyDir() + "Document.docx");
XlsxSaveOptions saveOptions = new XlsxSaveOptions();
saveOptions.setCompressionLevel(CompressionLevel.MAXIMUM);
doc.save(getArtifactsDir() + "BaseConversions.CompressXlsx.xlsx", saveOptions);Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.