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);
            }
        }
        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);
            }
        }
        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 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);
            }
        }