Bug 31138 - when open a xlsx file,occur a exception "Operation not valid when package is read-only"
Summary: when open a xlsx file,occur a exception "Operation not valid when package is ...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WindowsBase (show other bugs)
Version: 4.0.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-16 01:10 UTC by mawei
Modified: 2015-06-16 01:10 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description mawei 2015-06-16 01:10:44 UTC
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;

namespace Opex.OfficeFileHandler
{
    public static partial class ExcelHandler
    {
        public static SpreadsheetDocument OpenXlDocument(string fileName, bool isEditable = false)
        {
            try
            {
                SpreadsheetDocument xlDocument = SpreadsheetDocument.Open(fileName, isEditable);
                return xlDocument;
            }
			catch (Exception e)
            {
                return null;
            }
        }
    }
}

Note You need to log in before you can comment on or make changes to this bug.