Thursday, 22 May 2014

How to fix error - The type or namespace name Package could not be found (are you missing a using directive or an assembly reference?)

Watch this example on YouTube:


add

using System.IO.Packaging;

and now you can execute code like:
            MemoryStream l_memStrm = new MemoryStream(512);

            Package l_memPack = Package.Open(l_memStrm, FileMode.Create, FileAccess.ReadWrite);
            SpreadsheetDocument l_package = SpreadsheetDocument.Create(l_memPack, SpreadsheetDocumentType.Workbook);
            var workbookPart = l_package.AddWorkbookPart();

No comments:

Post a Comment