private void WriteAltChunks(DocxContentBuilder chunks, DocxXmlWriter writer, PackagePart parentPart)
        {
            for (int chunkIndex = 0; chunkIndex < chunks.Count; chunkIndex++)
            {
                DocxChunk chunk = chunks[chunkIndex];
                this.altChunkCounter++;

                string altChunkId = DocxPackageWriter.AltChunkPartialId + altChunkCounter;
                writer.WriteElement("altChunk", "id", altChunkId);

                string altChunkPath = DocxPackageWriter.AltChunkPartialPath + altChunkCounter + chunk.Extension;
                this.CreateAltChunkPart(chunk, altChunkPath, altChunkId, parentPart);
            }
        }
        private void CreateHeaderOrFooterPart(string partPath, string partContentType, string partRelationshipType, string id, string elementName, DocxContentBuilder chunks)
        {
            Uri partUri = new Uri(partPath, UriKind.Relative);
            PackagePart part = this.CreatePart(partUri, partContentType);

            using (DocxXmlWriter writer = new DocxXmlWriter(part.GetStream()))
            {
                writer.WriteStartDocument(elementName);
                this.WriteAltChunks(chunks, writer, part);
                writer.WriteEndDocument();
            }

            CreatePartRelationship(partUri, partRelationshipType, id, this.documentPart);
        }
        private void WriteAltChunks(DocxContentBuilder chunks, DocxXmlWriter writer, PackagePart parentPart)
        {
            for (int chunkIndex = 0; chunkIndex < chunks.Count; chunkIndex++)
            {
                DocxChunk chunk = chunks[chunkIndex];
                this.altChunkCounter++;

                string altChunkId = DocxPackageWriter.AltChunkPartialId + altChunkCounter;
                writer.WriteElement("altChunk", "id", altChunkId);

                string altChunkPath = DocxPackageWriter.AltChunkPartialPath + altChunkCounter + chunk.Extension;
                this.CreateAltChunkPart(chunk, altChunkPath, altChunkId, parentPart);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of <see cref="DocxFile"/> class.
 /// </summary>
 public DocxFile() { this.body = new DocxContentBuilder(); }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of <see cref="DocxFile"/> class.
 /// </summary>
 public DocxFile()
 {
     this.body = new DocxContentBuilder();
 }
        private void CreateHeaderOrFooterPart(string partPath, string partContentType, string partRelationshipType, string id, string elementName, DocxContentBuilder chunks)
        {
            Uri         partUri = new Uri(partPath, UriKind.Relative);
            PackagePart part    = this.CreatePart(partUri, partContentType);

            using (DocxXmlWriter writer = new DocxXmlWriter(part.GetStream()))
            {
                writer.WriteStartDocument(elementName);
                this.WriteAltChunks(chunks, writer, part);
                writer.WriteEndDocument();
            }

            CreatePartRelationship(partUri, partRelationshipType, id, this.documentPart);
        }