Exemplo n.º 1
0
        private void WriteHeaderAndFooter(DocxFile docx, DocxXmlWriter writer)
        {
            writer.WriteStartElement("sectPr");
            int idCounter = 1;

            if (docx.HasHeader)
            {
                string id = "rId" + idCounter;
                writer.WriteElement("headerReference", "id", id, "type", "default");

                this.CreateHeaderOrFooterPart(
                    DocxPackageWriter.HeaderPath,
                    Resources.HeaderContentType,
                    Resources.HeaderRelationshipType,
                    id, "hdr", docx.Header);

                idCounter++;
            }

            if (docx.HasFooter)
            {
                string id = "rId" + idCounter;
                writer.WriteElement("footerReference", "id", id, "type", "default");

                this.CreateHeaderOrFooterPart(
                    DocxPackageWriter.FooterPath,
                    Resources.FooterContentType,
                    Resources.FooterRelationshipType,
                    id, "ftr", docx.Footer);
            }
        }
Exemplo n.º 2
0
        private void WriteHeaderAndFooter(DocxFile docx, DocxXmlWriter writer)
        {
            writer.WriteStartElement("sectPr");
            int idCounter = 1;

            if (docx.HasHeader)
            {
                string id = "rId" + idCounter;
                writer.WriteElement("headerReference", "id", id, "type", "default");

                this.CreateHeaderOrFooterPart(
                    DocxPackageWriter.HeaderPath,
                    Resources.HeaderContentType,
                    Resources.HeaderRelationshipType,
                    id, "hdr", docx.Header);

                idCounter++;
            }

            if (docx.HasFooter)
            {
                string id = "rId" + idCounter;
                writer.WriteElement("footerReference", "id", id, "type", "default");

                this.CreateHeaderOrFooterPart(
                    DocxPackageWriter.FooterPath,
                    Resources.FooterContentType,
                    Resources.FooterRelationshipType,
                    id, "ftr", docx.Footer);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }