wordpress hit counter
Welcome to OpenXML Developer Sign in | Join | Help

The specified package is invalid. The main part is missing.

Last post 02-18-2010, 1:19 PM by zeyadrajabi. 3 replies.
Sort Posts: Previous Next
  •  01-18-2010, 3:13 PM 8032

    The specified package is invalid. The main part is missing.

    Hello !

    I try  open OpenXml with Open xml sdk 2.0 - but it failded.

    using (WordprocessingDocument myDoc = WordprocessingDocument.Open(fileName, true)) { }

    I have exception : A first chance exception of type 'DocumentFormat.OpenXml.Packaging.OpenXmlPackageException' occurred in DocumentFormat.OpenXml.dll Exception : The specified package is invalid. The main part is missing.

     why ?

    Everything happened correctly few months ago. But today I have some problem , maybe it is the reason of windows or microsoft standard updating?

    If yes, what shoud I do?

  •  02-01-2010, 9:46 PM 8070 in reply to 8032

    Re: The specified package is invalid. The main part is missing.

    Hi Jolibal,

    What is the document you are trying to open? Try opening this in word and see if you get the same issue.

    Thanks

    Jay
  •  02-06-2010, 1:30 PM 8117 in reply to 8070

    Re: The specified package is invalid. The main part is missing.

    I'm having the same problem.  I created a spreadsheet in Excel, saved as ODS, but when I try reading it I get the error above.  I tried looking at the file but it must be compressed 'cause it's mostly binary.  Excel's File Properties confirms the file is OpenDocument Spreadsheet format.

    The code I used to try opening it (with 2.0 SDK) is:

            [TestMethod]
            public void LoadSaveTest()
            {
                var simpleFilePath = // the file's path
                var outputFilePath = // an output file path

                if (!File.Exists(simpleFilePath))
                    throw new FileNotFoundException(simpleFilePath);

                var aSheet = SpreadsheetDocument.Open(simpleFilePath, false);
            }

    What I want for a test is to simply open the ODS and save it under another name.  After fixing the exception (thrown on the Open()) I need to figure out how to save it.

  •  02-18-2010, 1:19 PM 8174 in reply to 8117

    Re: The specified package is invalid. The main part is missing.

    The Open XML SDK is not able to open ODF formats, such as ODS or ODT.
View as RSS news feed in XML