Open-XML-SDK: Documents fail to open on Mono with System.IO.Packaging library
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
IDE: Visual Studio for Mac .NET Runtime: Mono 5.0.1.1 OpenXML: 2.7.2.0 OS: macOS 10.12.5
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (8 by maintainers)
@owlwang : I’ll look into the file and get back.