2

I have created the file and written some data on it. When I look for created file in windows explorer it is not present. On the other side am not able to relate with the path of the file which I get on emulator. This is the link am using. Kindly help.

http://www.codeproject.com/Articles/33850/Generate-Excel-files-without-using-Microsoft-Excel?fid=1536838&df=90&mpp=10&noise=1&prof=True&sort=Position&view=Expanded&spc=None&fr=11#xx0xx

1 Answer 1

1

WP8 supports opening up office in read-only mode with your files. In order to do that you'll need to activate Excel's app2app file extension. The excel office app is registered to the XLS and XLSX file extensions.

To send Office files you'll first need write the complete file into Isolated Storage. Once the file is in IsolatedStorage send it over to office by using Launcher.LaunchFileAsync().

    private async void LaunchExcel(object sender, RoutedEventArgs e)
    {
        var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("myExcelFile.xlsx");
        using (var s = await file.OpenAsync(FileAccessMode.ReadWrite))
        using (var dw = new DataWriter(s))
        {
            dw.WriteString("hello world");
        }

        await Launcher.LaunchFileAsync(
            await ApplicationData.Current.LocalFolder.GetFileAsync("myExcelFile.xlsx"));
    }

I'm not sure if the XLS format the article you linked to is actually supported by office on WP8. If it's not consider using the ClosedXML OSS project to generate an XLSX office open XML @ http://closedxml.codeplex.com/

2
  • Can I use this "closedxml" library for windows phone 8? when am trying to add this library , it throws an exception . The error reads "A reference to a higher version or incompatible assembly cannot be added to the project." Dec 5, 2012 at 6:03
  • I've never tried ClosedXML on WP. You might have to do some porting work yourself. The business logic in terms of XLSX format and content should be identical. Dec 5, 2012 at 16:49

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.