Aspose.Words for .Net是一種高級Word文檔處理API,用於執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和列印文檔,而無需在跨平臺應用程式中直接使用Microsoft Word。 Aspose.Words API提供了將Microsoft Word文檔從DOC或D ...
Aspose.Words for .Net是一種高級Word文檔處理API,用於執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和列印文檔,而無需在跨平臺應用程式中直接使用Microsoft Word。
Aspose.Words API提供了將Microsoft Word文檔從DOC或DOCX格式序列化為位元組數組的最簡單方法。將文檔存儲到資料庫中和/或從資料庫中檢索時,將Word文檔轉換為位元組數組很有幫助。
另外!.NET版Aspose Words轉換升級,支持將PDF轉換為PDF 1.7標準!近日,Aspose Words For .NET更新到了v19.12版,在Windows10上使用SystemFontSource時,支持用戶安裝的字體,OLE對象數據公開給公共API等等9大新功能。(下載地址可在評論區查看)
.NET的Aspose.Words可用於轉換Document對象,以獲取表示任何.NET應用程式中Document的位元組數組。以下代碼段演示了DOC文件到位元組數組的轉換。
// Load the document from disk.
Document doc = new Document("Sample.doc");
// Create a new memory stream.
MemoryStream outStream = new MemoryStream();
// Save the document to stream.
doc.Save(outStream, SaveFormat.Docx);
// Convert the document to byte form.
byte[] docBytes = outStream.ToArray();
// The bytes are now ready to be stored/transmitted.
// Now reverse the steps to load the bytes back into a document object.
MemoryStream inStream = new MemoryStream(docBytes);
// Load the stream into a new document object.
Document loadDoc = new Document(inStream);
// Save the document.
loadDoc.Save("loadDoc.docx",SaveFormat.Docx);
以下代碼段演示瞭如何使用Aspose.Words for Java API 將DOC文件轉換為位元組數組。
// Load the document.
Document doc = new Document("Sample.doc");
// Create a new memory stream.
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
// Save the document to stream.
doc.save(outStream, SaveFormat.DOCX);
// Convert the document to byte form.
byte[] docBytes = outStream.toByteArray();
// The bytes are now ready to be stored/transmitted.
// Now reverse the steps to load the bytes back into a document object.
ByteArrayInputStream inStream = new ByteArrayInputStream(docBytes);
// Load the stream into a new document object.
Document loadDoc = new Document(inStream);
// Save the document.
loadDoc.Save("loadDoc.docx",SaveFormat.Docx);
如果您有任何疑問或需求,請隨時加入Aspose技術交流群(642018183),很高興為您提供查詢和咨詢。