question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documents fail to open on Mono with System.IO.Packaging library

See original GitHub issue

When I use the following code: https://msdn.microsoft.com/en-us/library/office/gg575571.aspx

static void ReadExcelFileDOM(string fileName)
{
    using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(fileName, false))
    {
        WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
        WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
        SheetData sheetData = worksheetPart.Worksheet.Elements<SheetData>().First();
        string text;
        foreach (Row r in sheetData.Elements<Row>())
        {
            foreach (Cell c in r.Elements<Cell>())
            {
                text = c.CellValue.Text;
                Console.Write(text + " ");
            }
        }
        Console.WriteLine();
        Console.ReadKey();
    }
}

SpreadsheetDocument.Open() will report error PackageRelationship target must be relative URI if TargetMode is Internal. Parameter name: targetUri ece33856-977e-4ca2-a4ed-130577397063

IDE: Visual Studio for Mac .NET Runtime: Mono 5.0.1.1 OpenXML: 2.7.2.0 OS: macOS 10.12.5

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tarunchopracommented, Jul 28, 2017

@owlwang : I’ll look into the file and get back.

0reactions
twsouthwickcommented, Apr 9, 2018

Thanks for the update! Once there is a stable release of it, we’ll update the SDK to depend on it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documents fail to open on Mono with System.IO.Packaging ...
When I use the following code: https://msdn.microsoft.com/en-us/library/office/gg575571.aspx static void ReadExcelFileDOM(string fileName) ...
Read more >
c# - System.IO.Packaging
For example, on my machine (Windows 7, 64-bit) the complete path is: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.
Read more >
Package.Open Method (System.IO.Packaging)
The package to open requires read or read/write permission and the specified stream is write-only; or, the package to open requires write or...
Read more >
[SOLVED] DirectoryNotFoundException with different ...
Hey there, Unity version: 2018.3.7f1 Recently I noticed that everytime I install a package from the PackageManager I get a bunch of errors ......
Read more >
System.IO.Packaging 7.0.0
Provides classes that support storage of multiple data objects in a single container.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found