翻譯|使用教程|編輯:黃竹雯|2019-01-31 09:53:47.000|閱讀 420 次
概述:Aspose.Words無(wú)需Microsoft Word也可在任何平臺(tái)上滿足Word文檔的一切操作需求。本文將與大家分享Xamarin和.NET Standard 2.0 API的差異和局限。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Aspose.Words無(wú)需Microsoft Word也可在任何平臺(tái)上滿足Word文檔的一切操作需求。本文將與大家分享Xamarin和.NET Standard 2.0 API的差異和局限。
【下載Aspose.Words for .NET最新試用版】
Xamarin DLL總是使用Xamarin.Android,Xamarin.iOS和Xamarin.Mac最新且穩(wěn)定的版本構(gòu)建。如果你在Xamarin應(yīng)用程序中使用Aspose.Words的時(shí)候遇到問(wèn)題,請(qǐng)確保安裝了最新的Xamarin版本。有時(shí)Aspose.Words使用最新Xamarin版本構(gòu)建的Xamarin DLL并不適用于舊版本的Xamarin。
1.Document.Print方法在.NET Standard 2.0,Xamarin.Android,Xamarin.iOS和Xamarin.Mac API中不可用。
2.未提供保存到用戶瀏覽器功能,即Document.Save(HttpResponse,string,ContentDescription,SaveOptions)重載不可用。
3.由于目標(biāo)操作系統(tǒng)(Android,MacOS,Linux等)中缺少Windows字體,文檔中使用的字體將替換為可用字體,這可能導(dǎo)致文檔布局不準(zhǔn)確,將文檔呈現(xiàn)為固定頁(yè)面格式(如圖像,PDF,XPS)等等。
1.在Aspose.Words for .NET Standard 2.0中,使用Xamarin.Android,Xamarin.iOS和Xamarin.Mac SkiaSharp.SKBitmap對(duì)象代替.NET API中的System.Drawing.Bitmap。受影響的API列表:
.NET
// Use System.Drawing.Bitmap. using (System.Drawing.Bitmap image = new System.Drawing.Bitmap(gTestImagePath)) { builder.InsertImage(image); }
.NET Standard 2.0, Xamarin.Android, Xamarin.iOS and Xamarin.Mac
// Insert image into the document from SkiaSharp.SKBitmap object. using (SkiaSharp.SKBitmap bitmap = SkiaSharp.SKBitmap.Decode(gTestImagePath)) { builder.InsertImage(bitmap); }
2.在Aspose.Words for .NET Standard 2.0中,使用Xamarin.Android,Xamarin.iOS和Xamarin.Mac SkiaSharp.SKCanvas對(duì)象代替.NET API中使用的System.Drawing.Graphics對(duì)象。受影響的API列表:
.NET
Document doc = new Document(gTestDocumentPath); // Render the first page to System.Drawing.Graphics using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(1000, 1000)) { using (System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bitmap)) { // Apply required transformations to the graphics, rotation for example. gr.RotateTransform(45); doc.RenderToSize(0, gr, 0, 0, bitmap.Width, bitmap.Height); } // Save output to file. bitmap.Save(@"C:\Temp\out.png", System.Drawing.Imaging.ImageFormat.Png); }
.NET Standard 2.0, Xamarin.Android, Xamarin.iOS and Xamarin.Mac
Document doc = new Document(gTestDocumentPath); // Render the first page to SkiaSharp.SKCanvas using (SkiaSharp.SKBitmap bitmap = new SkiaSharp.SKBitmap(1000, 1000)) { using (SkiaSharp.SKCanvas canvas = new SkiaSharp.SKCanvas(bitmap)) { // Apply required transformations to the canvas, rotation for example. canvas.RotateDegrees(45); doc.RotateDegrees(0, canvas, 0, 0, bitmap.Width, bitmap.Height); } // Save output to file. using (SkiaSharp.SKFileWStream fs = new SkiaSharp.SKFileWStream(gOutPath+ "RenderToSize_Out.png")) { bitmap.Encode(fs, SkiaSharp.SKEncodedImageFormat.Png, 100); } }
1.要正常工作,Aspose.Words的Xamarin.Android API需要Encodings支持。在“Release”模式下運(yùn)行Xamarin.Android應(yīng)用程序時(shí),需要添加其他支持的編碼。請(qǐng)注意,在“Debug”模式下,可以在沒(méi)有這些選項(xiàng)的情況下工作。
2.如果你想使用Metered許可證,則需要允許你的應(yīng)用程序訪問(wèn)Internet。
要正常工作Aspose.Words的Xamarin.iOS API需要Encodings支持。當(dāng)你運(yùn)行Xamarin.iOS應(yīng)用程序時(shí),需要添加其他支持的編碼。
1.要正常工作,Aspose.Words的Xamarin.Mac API需要Encodings支持。當(dāng)您運(yùn)行Xamarin.Mac應(yīng)用程序時(shí),需要添加其他支持的編碼。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn