Hi!
I've been trying to append pictures to the word document generated by DocIO without much success. From what I understood, in Xamarin we must do this by using a byte[] that is the result of an image conversion. I've searched the forums for a way of converting an image located on the drawable file (in Android) and the using the AppendPicture.
The closer I've managed to get was this:
WordDocument localdocumento = new WordDocument();
IWSection localSection = localdocumento.AddSection();
IWParagraph localparagraph = localSection.AddParagraph();
ImageSource imagem = ImageSource.FromFile("MyLogo.jpg"); //This file is located on Android's drawable file path byte[] localbyte = Encoding.UTF8.GetBytes(imagem.ToString());
IWPicture localpicture = localparagraph.AppendPicture(localbyte);
|
But the image file doesn't work properly. I've also tried using FFImageLoading library, but it didn't work as well (it gives me a null reference). Is there a simple way of achieving this on xamarin forms? Any help is appreciated!