2014-03-18 18 views
1

描述: 使用aspose單詞將word文檔轉換爲html文件時,它從word文檔中提取圖像並將其存儲在當前文件夾中,並將引用傳遞給html「src」標籤,以便可以顯示圖像在轉換後的html文件中。轉換Word文檔時Azure雲上的圖像問題。 to html使用aspose.words

問題: 當我上傳的轉換後的HTML文件到微軟Azure雲(即BLOB)不顯示圖像, 原因是要顯示在HTML文件中的圖像微軟限制被嵌入的圖像上傳到首先blob,然後將每個圖像的url傳遞給html文件的「src」標籤。

Aspose單詞如何解決此問題?

我使用Asp.Net MVC 4作爲開發框架。

回答

1

Aspose.Words API提供的功能可以將Word文件中的圖像以Base64字符串形式導出爲HTML。這樣圖像就嵌入在HTML文件中,您不需要分別上傳任何圖像文件夾/圖像。以下是示例代碼:

//Open the Word document 
Document doc = new Document("C:\\data\\image.doc"); 

//instantiate HTML saving options 
Aspose.Words.Saving.HtmlSaveOptions option = new Aspose.Words.Saving.HtmlSaveOptions(); 

//Export the images in doc to Base64 string 
option.ExportImagesAsBase64 = true; 

//Save format is HTML 
option.SaveFormat = Aspose.Words.SaveFormat.Html; 

//Save the resultant HTML file 
doc.Save("C:\\Data\\Image2.html",option); 

希望這會有所幫助。