C1.Xaml.Excel for UWP

Posted by: li.yihua on 26 October 2017, 1:43 pm EST

    • Post Options:
    • Link

    Posted 26 October 2017, 1:43 pm EST

    Hello,

    I want to Open an template excel file from Asstets,

    Windows.Storage.StorageFolder installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;

    StorageFolder tempFolder2 = await installedLocation.CreateFolderAsync(“Assets”, CreationCollisionOption.OpenIfExists);

    StorageFile file =await tempFolder2.CreateFileAsync(“cgktemplate.xlsx”, CreationCollisionOption.OpenIfExists);

    _book = new C1XLBook();

    await _book.LoadAsync(file, FileFormat.OpenXml); //It cannot working. trow an Exception. why?

  • Posted 26 October 2017, 10:39 pm EST

    Hi,

    I tried using your code snippet and observed the following:

    1. Using ```

      Windows.Storage.StorageFolder installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
    To resolve this, you may replace it with ```
    Windows.Storage.StorageFolder installedLocation =  [b]ApplicationData.Current.LocalFolder[/b];
    
    1. Using code snippet in point#1, an exception C1.C1Zip.ZipFileException:Central dir not found was thrown.

      To resolve this, try adding some content to XLSX file, before loading the same.

    I have uploaded a sample application for your reference, you may download the same using the following URL:https://www.dropbox.com/s/jqypxhre9ces9sl/prj_assetExcel.zip?dl=0

    Regards,

    Ruchir Agarwal

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels