Questions tagged [system.io.packaging]

system.io.packaging is Microsoft's system for creating and packaging complex multi-part documents. It is used by Microsoft Office for common formats like xlsx and docx, among others.

System.IO.Packaging is Microsoft's system for creating and packaging complex multi-part documents. It is used by Microsoft Office for common formats like xlsx and docx, among others.

The Package format is essentially a ZIPped folder with the document contents, the Parts, normally placed in subfolders in the ZIP. You can examine a Package by renaming it .zip and opening it, for instance, an xlsx file.

System.IO.Packaging can also be used as a basic ZIP library, but it will insist on adding a file at the root called [Content Types].xml.

42 questions
2
votes
3 answers

How to use System.IO.Packaging in MonoTouch

I got a problem while trying to use the System.IO.Packaging in MonoTouch. I cant found this ressource. Can anybody tell me where to find this ressource?
Alex
  • 459
  • 3
  • 14
1
vote
1 answer

Unpacking zip file in c# using System.IO.Packaging

I want to unzip a file in c# using the System.IO.Packaging namespace. I know there is a zip library, but I would rather first explore if I can achieve the same without adding extra dependencies. Here is my code: using (var fs = new FileStream(fn1,…
Staale
  • 27,254
  • 23
  • 66
  • 85
1
vote
1 answer

Digitally sign .xlsx file using System.IO.Packaging in c#

Greeings, I am trying to digitally sign an excel file using System.IO.Packaging but I can't get this working. The simplified code I am using is as follows: var packageFile = @"C:\temp\test.xlsx"; var package = Package.Open(packageFile,…
1
vote
1 answer

c# Problem with my Xpath? Parsing Xml from a DocX file using Package.GetPart

I have a class called Reader public class Reader Here is the constructor public Reader(string fileName) { using (Package package = Package.Open(AppDomain.CurrentDomain.BaseDirectory + "\\" + fileName + ".docx")) { …
LeiMagnus
  • 253
  • 2
  • 13
1
vote
0 answers

Add an arrow to a chart in Word by direct xml manipulation

I have been attempting to add a line to a simple chart in word. This code won't create a working document. It would be great if someone could tell me why. In the actual application I'm working on the "package" variable refers to a…
Owen Smith
  • 63
  • 6
1
vote
1 answer

Adding a macro file to an XLSX/XLSM file using Packaging

I'm using System.IO.Packaging to build simple Excel files. One of our customers would like to have an autorun macro that updates data and recalcs the sheet. Pulling apart existing sheets I can see that all you need to do is add the vbaProject.bin…
Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98
1
vote
0 answers

Getting "File contains corrupted data" exception while opening the XPSDocument Package

I am getting the exception within my Console Application HResult -2146233033 InnerException null Message File contains corrupted data. Source WindowsBase SourceUri null StackTrace at…
HGMamaci
  • 1,339
  • 12
  • 20
1
vote
0 answers

Is it possible to NOT store the folder structure when creating a zip with the package class?

I'm using the Package class to create a zip file. This works quite fine. The only thing I don't want to have there (which exists) is: The folder structure is also saved. Despite looking through the class I found no parameter there so I fear it is…
Thomas
  • 2,886
  • 3
  • 34
  • 78
1
vote
1 answer

FileShare.ReadWrite in System.IO.Packaging

I am using System.IO.Packaging to work with Package files. But it seems Package cannot open a file with read access providing FileShare.ReadWrite. Here's the code : myPackage = Package.Open("fileName", FileMode.Open, FileAccess.Read, …
user3868244
  • 121
  • 2
  • 12
1
vote
0 answers

System.IO.Packaging Missing Override in [Content_Types].xml file

I am facing the problem that was discussed here [Content_Types].xml element missing. Proposed solution is Uri File1_rel = new Uri(@"/OddContent/File1.xml", UriKind.Relative); Uri File2_rel = new Uri(@"/OddContent/File2.xml",…
Saqwes
  • 325
  • 3
  • 12
1
vote
0 answers

Should the result of PackagePart.GetStream() be disposed?

Should the caller of PackagePart.GetStream dispose the returned Stream object? Or does this method return an object that could be reused? The documentation doesn't say. Looking at the .NET source code, almost every place calling GetStream()…
Joey Adams
  • 41,996
  • 18
  • 86
  • 115
1
vote
1 answer

C# - Using protobuf to write directly into a zip file

I am working on a simulator program that writes small data (<1kB) frequently (> 10 times a second) in a file. I used a Queue to store these data and when this queue had 300 members or more, it'll write data to a file stored in a zip file and clear…
Mohammad Jafar Mashhadi
  • 4,102
  • 3
  • 29
  • 49
1
vote
2 answers

Will PackageDigitalSignatureManager.VerifySignatures() lead to a call outside the network?

I have a business requirement to check the digital signature on an Open Packaging Conventions Package (it's a Word document) prior to continuing to process the document. The package is signed by me prior to delivering it to the client, so my code…
1
vote
1 answer

packaging files to be read without need for extraction

In my current project i'm dealing with a huge number of files (over tens of milliard files with low volume-between 1 and 30 KB) as resources which copying them for my customer is time consuming job. i'm searching for a packaging mechanism that can…
IT Seeker
  • 82
  • 8
0
votes
0 answers

C#, System.IO.Packaging, Package.Open, System.IO.IOException when creating a file in device root

In my code using (var package = Package.Open(filePathAndName, FileMode.Create)) { errorCode = WritePackagedPartGroups(package, partGroups); if (errorCode == PackagedIOErrorCode.NoError && signCertificate != null) { …
S. Seidel
  • 11
  • 4