We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Unable to read the file path

Thread ID:





140974 Nov 16,2018 01:38 PM UTC Nov 19,2018 06:51 AM UTC Xamarin.Forms 2
Tags: XlsIO
Asked On November 16, 2018 01:38 PM UTC

Hi ,

   I am using your Xlslo controller.but here i could not convert the url to stream .getting null reference exception.please take a look into my code.

  ExcelEngine excelEngine = new ExcelEngine();
string myurl="http://emtmsdevt.devtpit.com/DocumentLibrary/TopicFiles/ImportStaff19.xlsx"; //this is my excel file.which is come from DB. i need to open 
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream inputStream = assembly.GetManifestResourceStream(myurl);
IWorkbook workbook = application.Workbooks.Open(inputStream);

Replied On November 19, 2018 04:00 AM UTC

Can anybody help me out from this ? i am waiting for your reply .

Prakash Kumar D [Syncfusion]
Replied On November 19, 2018 06:51 AM UTC

Hi Bharathi, 
Thank you for contacting Syncfusion support. 
The “assembly.GetManifestResourceStream(myurl)” method returns null when the resource file is not as an embedded resource in the Xamarin project. We suggest you refer the below code snippet to open file from an URL in Xamarin Forms. 
Code snippet: 
//Create an instance of ExcelEngine. 
using (ExcelEngine excelEngine = new ExcelEngine()) 
    //Set the default application version as Excel 2013. 
    excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2013; 
    string myurl = "http://emtmsdevt.devtpit.com/DocumentLibrary/TopicFiles/ImportStaff19.xlsx"; //this is my excel file.which is come from DB. i need to open  
    var webClient = new WebClient(); 
    byte[] file = webClient.DownloadData(myurl); 
    Stream fileStream = new MemoryStream(file); 
    //Create a workbook with a worksheet 
    IWorkbook workbook = excelEngine.Excel.Workbooks.Open(fileStream); 
    //Access first worksheet from the workbook instance. 
    IWorksheet worksheet = workbook.Worksheets[0]; 
    //Adding text to a cell 
    worksheet.Range["A1"].Text = "Hello World"; 
    //Save the workbook to stream in xlsx format.  
    MemoryStream stream = new MemoryStream(); 
Please let us know if you need further assistance on this. 
Prakash Kumar 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon