public void Deserialize(IntermediateFormatReader reader)
        {
            reader.RegisterDeclaration(OpenXmlBorderPropertiesModel.GetDeclaration());
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.Color:
                    this.Color = reader.ReadString();
                    break;

                case MemberName.Width:
                    this._widthInEighthPoints = reader.ReadInt32();
                    break;

                case MemberName.Style:
                    this.Style = (BorderStyle)reader.ReadByte();
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public override void Serialize(IntermediateFormatWriter writer)
        {
            base.Serialize(writer);
            writer.RegisterDeclaration(HeaderFooterReferences.GetDeclaration());
            while (writer.NextMember())
            {
                switch (writer.CurrentMember.MemberName)
                {
                case MemberName.Header:
                    writer.Write(this.Header);
                    break;

                case MemberName.Footer:
                    writer.Write(this.Footer);
                    break;

                case MemberName.FirstPageHeader:
                    writer.Write(this.FirstPageHeader);
                    break;

                case MemberName.FirstPageFooter:
                    writer.Write(this.FirstPageFooter);
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
Ejemplo n.º 3
0
 public void WriteTableCellBegin(int cellIndex, int numColumns, bool firstVertMerge, bool firstHorzMerge, bool vertMerge, bool horzMerge)
 {
     if (this._state == State.InRow)
     {
         this._state       = State.InCell;
         this._currentCell = new OpenXmlTableCellModel(this.CurrentCell, this._currentTable.TableProperties, this._interleavingWriter.TextWriter);
         this._currentCell.CellProperties.Width = this._currentRow.ColumnWidths[cellIndex];
         if (firstHorzMerge)
         {
             this._currentCell.CellProperties.HorizontalMerge = OpenXmlTableCellPropertiesModel.MergeState.Start;
         }
         else if (horzMerge)
         {
             this._currentCell.CellProperties.HorizontalMerge = OpenXmlTableCellPropertiesModel.MergeState.Continue;
         }
         if (firstVertMerge)
         {
             this._currentCell.CellProperties.VerticalMerge = OpenXmlTableCellPropertiesModel.MergeState.Start;
         }
         else if (vertMerge)
         {
             this._currentCell.CellProperties.VerticalMerge = OpenXmlTableCellPropertiesModel.MergeState.Continue;
         }
         this._currentCell.CellProperties.BackgroundColor = this._currentTable.TableProperties.BackgroundColor;
     }
     else
     {
         WordOpenXmlUtils.FailCodingError();
     }
 }
        public void Serialize(IntermediateFormatWriter writer)
        {
            writer.RegisterDeclaration(OpenXmlBorderPropertiesModel.GetDeclaration());
            while (writer.NextMember())
            {
                switch (writer.CurrentMember.MemberName)
                {
                case MemberName.Color:
                    writer.Write(this.Color);
                    break;

                case MemberName.Width:
                    writer.Write(this._widthInEighthPoints);
                    break;

                case MemberName.Style:
                    writer.Write((byte)this.Style);
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        private Relationship AddRelationship(string location, string relationshipType, string parentLocation, TargetMode mode)
        {
            if (!_relationships.ContainsKey(parentLocation) || _relationships[parentLocation] == null)
            {
                _relationships[parentLocation] = new List <Relationship>();
            }
            else
            {
                foreach (Relationship item in _relationships[parentLocation])
                {
                    if (item.RelatedPart == location)
                    {
                        return(item);
                    }
                }
            }
            Relationship relationship = new Relationship();

            relationship.RelatedPart      = location;
            relationship.RelationshipId   = NextRelationshipId();
            relationship.RelationshipType = relationshipType;
            relationship.Mode             = mode;
            _relationships[parentLocation].Add(relationship);
            Uri targetUri = (relationship.Mode != 0) ? new Uri(relationship.RelatedPart, UriKind.Absolute) : new Uri(WordOpenXmlUtils.CleanName(relationship.RelatedPart), UriKind.Relative);

            if (parentLocation == "/")
            {
                _package.CreateRelationship(targetUri, relationship.Mode, relationship.RelationshipType, relationship.RelationshipId);
            }
            else
            {
                _package.GetPart(new Uri(WordOpenXmlUtils.CleanName(parentLocation), UriKind.Relative)).CreateRelationship(targetUri, relationship.Mode, relationship.RelationshipType, relationship.RelationshipId);
            }
            return(relationship);
        }
 public void AddText(string text, OpenXmlRunPropertiesModel style)
 {
     if (!string.IsNullOrEmpty(text))
     {
         StringBuilder stringBuilder = new StringBuilder();
         bool          flag          = true;
         foreach (char c in text)
         {
             if (c != '\r')
             {
                 if (c == '\n')
                 {
                     this.AddRun(stringBuilder, !flag, style);
                     stringBuilder = new StringBuilder();
                     flag          = false;
                 }
                 else if (c < ' ')
                 {
                     stringBuilder.Append(' ');
                 }
                 else
                 {
                     stringBuilder.Append(WordOpenXmlUtils.EscapeChar(c));
                 }
             }
         }
         this.AddRun(stringBuilder, !flag, style);
     }
 }
Ejemplo n.º 7
0
 public void WriteTableRowBegin(float left, float height, float[] columnWidths)
 {
     if (this._state == State.InTable)
     {
         this._currentTable.WriteProperties();
         int[] array = new int[columnWidths.Length];
         int   num   = 0;
         for (int i = 0; i < array.Length; i++)
         {
             int num2 = WordOpenXmlUtils.ToTwips(columnWidths[i]);
             if ((float)(num + num2) > 31680.0)
             {
                 num2 = (int)(31680.0 - (float)num);
             }
             num     += num2;
             array[i] = num2;
         }
         this._currentTable.TableGrid.AddRow(array);
         this._state      = State.InRow;
         this._currentRow = new OpenXmlTableRowModel(this.CurrentRow, this._interleavingWriter);
         this._currentRow.RowProperties.Height    = height;
         this._currentRow.ColumnWidths            = array;
         this._currentRow.RowProperties.RowIndent = left;
     }
     else
     {
         WordOpenXmlUtils.FailCodingError();
     }
 }
Ejemplo n.º 8
0
        public Relationship AddImageToTree(ImageHash hash, string extension, string relationshipType, string locationHint, string parentLocation, ContentTypeAction ctypeAction, out bool newBlob)
        {
            PhantomPart phantomPart = new PhantomPart();

            phantomPart.ContentType = "image/" + extension;
            if (_blobPathsByUniqueId.TryGetValue(hash, out string value))
            {
                phantomPart.Location = value;
                newBlob = false;
            }
            else
            {
                int num;
                switch (extension)
                {
                default:
                    num = 0;
                    break;

                case "jpg":
                case "png":
                case "gif":
                    num = -1;
                    break;
                }
                CompressionOption compressionOption = (CompressionOption)num;
                value = string.Format(CultureInfo.InvariantCulture, UniqueLocation(locationHint), extension);
                _blobPathsByUniqueId[hash] = value;
                phantomPart.Location       = value;
                _parts.Add(phantomPart.Location, phantomPart);
                _package.CreatePart(new Uri(WordOpenXmlUtils.CleanName(phantomPart.Location), UriKind.Relative), phantomPart.ContentType, compressionOption);
                newBlob = true;
            }
            return(AddRelationship(phantomPart.Location, relationshipType, parentLocation));
        }
 public void Write(TextWriter writer)
 {
     if (_hanging.HasValue || _first.HasValue || _left.HasValue || _right.HasValue)
     {
         writer.Write("<w:ind");
         if (_left.HasValue)
         {
             writer.Write(" w:left=\"");
             writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_left.Value), -31680, 31680));
             writer.Write("\"");
         }
         if (_right.HasValue)
         {
             writer.Write(" w:right=\"");
             writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_right.Value), -31680, 31680));
             writer.Write("\"");
         }
         if (_hanging.HasValue)
         {
             writer.Write(" w:hanging=\"");
             writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_hanging.Value), 0, 31680));
             writer.Write("\"");
         }
         if (_first.HasValue)
         {
             writer.Write(" w:firstLine=\"");
             writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_first.Value), 0, 31680));
             writer.Write("\"");
         }
         writer.Write("/>");
     }
 }
Ejemplo n.º 10
0
        public override void Deserialize(IntermediateFormatReader reader)
        {
            base.Deserialize(reader);
            reader.RegisterDeclaration(GetDeclaration());
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.Header:
                    Header = reader.ReadString();
                    break;

                case MemberName.Footer:
                    Footer = reader.ReadString();
                    break;

                case MemberName.FirstPageHeader:
                    FirstPageHeader = reader.ReadString();
                    break;

                case MemberName.FirstPageFooter:
                    FirstPageFooter = reader.ReadString();
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
        public override void Serialize(IntermediateFormatWriter writer)
        {
            base.Serialize(writer);
            writer.RegisterDeclaration(OpenXmlTableRowPropertiesModel.GetDeclaration());
            while (writer.NextMember())
            {
                switch (writer.CurrentMember.MemberName)
                {
                case MemberName.RowHeight:
                    writer.Write(this._height);
                    break;

                case MemberName.LeftIndent:
                    writer.Write(this._rowIndent);
                    break;

                case MemberName.ExactRowHeight:
                    writer.Write(this._exactRowHeight);
                    break;

                case MemberName.IgnoreRowHeight:
                    writer.Write(this._ignoreRowHeight);
                    break;

                case MemberName.TopPadding:
                    writer.Write(this._maxPaddingTop);
                    break;

                case MemberName.BottomPadding:
                    writer.Write(this._maxPaddingBottom);
                    break;

                case MemberName.TopBorder:
                    writer.Write(this._borderTop);
                    break;

                case MemberName.BottomBorder:
                    writer.Write(this._borderBottom);
                    break;

                case MemberName.LeftBorder:
                    writer.Write(this._borderLeft);
                    break;

                case MemberName.RightBorder:
                    writer.Write(this._borderRight);
                    break;

                case MemberName.Color:
                    writer.Write(this._bgColor);
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
        public override void Deserialize(IntermediateFormatReader reader)
        {
            base.Deserialize(reader);
            reader.RegisterDeclaration(OpenXmlTableRowPropertiesModel.GetDeclaration());
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.RowHeight:
                    this._height = reader.ReadSingle();
                    break;

                case MemberName.LeftIndent:
                    this._rowIndent = reader.ReadSingle();
                    break;

                case MemberName.ExactRowHeight:
                    this._exactRowHeight = reader.ReadBoolean();
                    break;

                case MemberName.IgnoreRowHeight:
                    this._ignoreRowHeight = reader.ReadBoolean();
                    break;

                case MemberName.TopPadding:
                    this._maxPaddingTop = reader.ReadSingle();
                    break;

                case MemberName.BottomPadding:
                    this._maxPaddingBottom = reader.ReadSingle();
                    break;

                case MemberName.TopBorder:
                    this._borderTop = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.BottomBorder:
                    this._borderBottom = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.LeftBorder:
                    this._borderLeft = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.RightBorder:
                    this._borderRight = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.Color:
                    this._bgColor = reader.ReadString();
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
        public override void Write(TextWriter output)
        {
            output.Write("<w:trPr>");
            if (this._rowIndent > 0.0)
            {
                output.Write("<w:wBefore w:w=\"");
                output.Write(WordOpenXmlUtils.ToTwips(this._rowIndent, 0f, 31680f));
                output.Write("\" w:type=\"dxa\"/>");
            }
            long num = (long)WordOpenXmlUtils.ToTwips(this._height) - (long)WordOpenXmlUtils.PointsToTwips((double)this._maxPaddingTop, 0.0, 31680.0) - WordOpenXmlUtils.PointsToTwips((double)this._maxPaddingBottom, 0.0, 31680.0);

            if (!this._ignoreRowHeight && num > 0)
            {
                output.Write("<w:trHeight w:val=\"");
                output.Write(WordOpenXmlUtils.TwipsToString(num, 0, 31680));
                output.Write(this._exactRowHeight ? "\" w:hRule=\"exact\"/>" : "\" w:hRule=\"atLeast\"/>");
            }
            output.Write("</w:trPr>");
            bool flag = this._borderTop != null || this._borderBottom != null || this._borderLeft != null || this._borderRight != null;

            if (flag || this._bgColor != null)
            {
                output.Write("<w:tblPrEx>");
            }
            if (flag)
            {
                output.Write("<w:tblBorders>");
                if (this._borderTop != null)
                {
                    this._borderTop.Write(output, "top");
                }
                if (this._borderLeft != null)
                {
                    this._borderLeft.Write(output, "left");
                }
                if (this._borderBottom != null)
                {
                    this._borderBottom.Write(output, "bottom");
                }
                if (this._borderRight != null)
                {
                    this._borderRight.Write(output, "right");
                }
                output.Write("</w:tblBorders>");
            }
            if (this._bgColor != null)
            {
                output.Write("<w:shd w:val=\"clear\" w:fill=\"");
                output.Write(this._bgColor);
                output.Write("\"/>");
            }
            if (!flag && this._bgColor == null)
            {
                return;
            }
            output.Write("</w:tblPrEx>");
        }
        public void Write(TextWriter writer)
        {
            writer.Write("<w:pPr>");
            if (_listLevel.HasValue || _listStyleId.HasValue)
            {
                writer.Write("<w:numPr>");
                if (_listLevel.HasValue)
                {
                    writer.Write("<w:ilvl w:val=\"");
                    writer.Write(_listLevel);
                    writer.Write("\"/>");
                }
                if (_listStyleId.HasValue)
                {
                    writer.Write("<w:numId w:val=\"");
                    writer.Write(_listStyleId);
                    writer.Write("\"/>");
                }
                writer.Write("</w:numPr>");
            }
            if (RightToLeft)
            {
                writer.Write("<w:bidi/>");
            }
            writer.Write("<w:spacing ");
            if (_pointsBefore.HasValue)
            {
                writer.Write("w:before=\"");
                writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_pointsBefore.Value), 0, 31680));
                writer.Write("\" ");
            }
            writer.Write("w:after=\"");
            writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(PointsAfter), 0, 31680));
            writer.Write("\" w:line=\"");
            writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_lineHeight), 0, 31680));
            writer.Write(_lineSpacingAtLeast ? "\" w:lineRule=\"atLeast\"/>" : "\" w:lineRule=\"auto\"/>");
            _indentation.Write(writer);
            if (_horizontalAlignment.HasValue)
            {
                switch (_horizontalAlignment.Value)
                {
                case HorizontalAlignment.Center:
                    writer.Write("<w:jc w:val=\"center\"/>");
                    break;

                case HorizontalAlignment.Left:
                    writer.Write("<w:jc w:val=\"left\"/>");
                    break;

                case HorizontalAlignment.Right:
                    writer.Write("<w:jc w:val=\"right\"/>");
                    break;
                }
            }
            writer.Write("</w:pPr>");
        }
Ejemplo n.º 15
0
 public override void Write(TextWriter output)
 {
     output.Write("<w:tblGrid>");
     foreach (int column in _columns)
     {
         output.Write("<w:gridCol w:w=\"");
         output.Write(WordOpenXmlUtils.TwipsToString(column, 0, 31680));
         output.Write("\"/>");
     }
     output.Write("</w:tblGrid>");
 }
Ejemplo n.º 16
0
        public Relationship AddStreamingPartToTree(string contentType, string relationshipType, string locationHint, string parentLocation, ContentTypeAction ctypeAction)
        {
            string      location    = this.UniqueLocation(locationHint);
            PhantomPart phantomPart = new PhantomPart();

            phantomPart.ContentType = contentType;
            phantomPart.Location    = location;
            this._parts.Add(phantomPart.Location, phantomPart);
            this._package.CreatePart(new Uri(WordOpenXmlUtils.CleanName(phantomPart.Location), UriKind.Relative), phantomPart.ContentType, CompressionOption.Normal);
            return(this.AddRelationship(location, relationshipType, parentLocation));
        }
Ejemplo n.º 17
0
        public Relationship AddImageToTree(Stream data, ImageHash hash, string extension, string relationshipType, string locationHint, string parentLocation)
        {
            bool         newBlob;
            Relationship relationship = _relationshipTree.AddImageToTree(hash, extension, relationshipType, locationHint, parentLocation, ContentTypeAction.Default, out newBlob);

            if (newBlob)
            {
                Stream stream = _zipPackage.GetPart(new Uri(WordOpenXmlUtils.CleanName(relationship.RelatedPart), UriKind.Relative)).GetStream();
                WordOpenXmlUtils.CopyStream(data, stream);
            }
            return(relationship);
        }
Ejemplo n.º 18
0
 public void WriteTableCellEnd(int cellIndex, BorderContext borderContext, bool emptyLayoutCell)
 {
     if (this._state == State.InCell)
     {
         this.CurrentCell.WriteCloseTag(emptyLayoutCell);
         this._currentCell = this.CurrentCell.ContainingCell;
         this._state       = State.InRow;
     }
     else
     {
         WordOpenXmlUtils.FailCodingError();
     }
 }
Ejemplo n.º 19
0
 public void WriteTableRowEnd()
 {
     if (this._state == State.InRow)
     {
         this.CurrentRow.WriteCloseTag();
         this._currentRow = this.CurrentRow.ContainingRow;
         this._state      = State.InTable;
     }
     else
     {
         WordOpenXmlUtils.FailCodingError();
     }
 }
Ejemplo n.º 20
0
        public Relationship AddImageToTree(Stream data, ImageHash hash, string extension, string relationshipType, string locationHint, string parentLocation)
        {
            bool         flag         = default(bool);
            Relationship relationship = this._relationshipTree.AddImageToTree(hash, extension, relationshipType, locationHint, parentLocation, ContentTypeAction.Default, out flag);

            if (flag)
            {
                Package     zipPackage = this._zipPackage;
                PackagePart part       = zipPackage.GetPart(new Uri(WordOpenXmlUtils.CleanName(relationship.RelatedPart), UriKind.Relative));
                Stream      stream     = part.GetStream();
                WordOpenXmlUtils.CopyStream(data, stream);
            }
            return(relationship);
        }
Ejemplo n.º 21
0
        public void WritePart(string location)
        {
            PackagePart  part         = this._package.GetPart(new Uri(WordOpenXmlUtils.CleanName(location), UriKind.Relative));
            StreamWriter streamWriter = new StreamWriter(part.GetStream());

            ((XmlPart)this._parts[location]).HydratedPart.Write(streamWriter);
            streamWriter.Flush();
            PhantomPart phantomPart = new PhantomPart();

            phantomPart.ContentType = part.ContentType;
            phantomPart.Location    = location;
            PhantomPart value = phantomPart;

            this._parts[location] = value;
        }
Ejemplo n.º 22
0
 public override void Serialize(IntermediateFormatWriter writer)
 {
     base.Serialize(writer);
     writer.RegisterDeclaration(GetDeclaration());
     while (writer.NextMember())
     {
         MemberName memberName = writer.CurrentMember.MemberName;
         if (memberName == MemberName.Columns)
         {
             writer.WriteListOfPrimitives(_columns);
         }
         else
         {
             WordOpenXmlUtils.FailSerializable();
         }
     }
 }
Ejemplo n.º 23
0
 public override void Deserialize(IntermediateFormatReader reader)
 {
     base.Deserialize(reader);
     reader.RegisterDeclaration(GetDeclaration());
     while (reader.NextMember())
     {
         MemberName memberName = reader.CurrentMember.MemberName;
         if (memberName == MemberName.Columns)
         {
             _columns = reader.ReadListOfPrimitives <int>();
         }
         else
         {
             WordOpenXmlUtils.FailSerializable();
         }
     }
 }
Ejemplo n.º 24
0
 public void WriteTableBegin(float left, bool layoutTable, AutoFit autofit)
 {
     if (this._state == State.InBody || this._state == State.InHeaderFooter || this._state == State.InCell)
     {
         if (this._state == State.InCell)
         {
             this._currentCell.PrepareForNestedTable();
         }
         this._state        = State.InTable;
         this._currentTable = new OpenXmlTableModel(this.CurrentTable, this._interleavingWriter, autofit);
         this._depth++;
     }
     else
     {
         WordOpenXmlUtils.FailCodingError();
     }
 }
        private static string Escape(string instruction)
        {
            StringBuilder stringBuilder = new StringBuilder(instruction.Length);

            foreach (char c in instruction)
            {
                if (c < ' ')
                {
                    stringBuilder.Append(' ');
                }
                else
                {
                    stringBuilder.Append(WordOpenXmlUtils.EscapeChar(c));
                }
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 26
0
        private Relationship AddPart(OoxmlPart part, string contentType, string relationshipType, string locationHint, string parentLocation, ContentTypeAction ctypeAction)
        {
            XmlPart xmlPart = new XmlPart();

            xmlPart.ContentType  = contentType;
            xmlPart.HydratedPart = part;
            if (locationHint.Contains("{0}"))
            {
                xmlPart.Location = this.UniqueLocation(locationHint);
            }
            else
            {
                xmlPart.Location = locationHint;
            }
            this._parts.Add(xmlPart.Location, xmlPart);
            this._package.CreatePart(new Uri(WordOpenXmlUtils.CleanName(xmlPart.Location), UriKind.Relative), xmlPart.ContentType, CompressionOption.Normal);
            return(this.AddRelationship(xmlPart.Location, relationshipType, parentLocation));
        }
Ejemplo n.º 27
0
        internal OpenXmlDocumentPropertiesModel(string author, string title, string description)
        {
            _propertyPart = new CorePropertiesPart();
            CT_CoreProperties obj = (CT_CoreProperties)_propertyPart.Root;

            obj.Creator = new SimpleLiteral
            {
                Content = WordOpenXmlUtils.Escape(author)
            };
            obj.Title = new SimpleLiteral
            {
                Content = WordOpenXmlUtils.Escape(title)
            };
            obj.Description = new SimpleLiteral
            {
                Content = WordOpenXmlUtils.Escape(description)
            };
        }
Ejemplo n.º 28
0
        public OpenXmlDocumentPropertiesModel(string author, string title, string description)
        {
            this._propertyPart = new CorePropertiesPart();
            CT_CoreProperties cT_CoreProperties = (CT_CoreProperties)this._propertyPart.Root;

            cT_CoreProperties.Creator = new SimpleLiteral
            {
                Content = WordOpenXmlUtils.Escape(author)
            };
            cT_CoreProperties.Title = new SimpleLiteral
            {
                Content = WordOpenXmlUtils.Escape(title)
            };
            cT_CoreProperties.Description = new SimpleLiteral
            {
                Content = WordOpenXmlUtils.Escape(description)
            };
        }
        public void Interleave(Stream output, FinalWriteInterleaver writeInterleaver)
        {
            _textWriter.Flush();
            StoreInterleaver();
            _stream.Seek(0L, SeekOrigin.Begin);
            long num = 0L;

            foreach (IInterleave item in _interleavingContent)
            {
                WordOpenXmlUtils.CopyStream(_stream, output, item.Location - num);
                num = item.Location;
                StringBuilder stringBuilder = new StringBuilder();
                using (StringWriter output2 = new StringWriter(stringBuilder, CultureInfo.InvariantCulture))
                {
                    writeInterleaver(item, output2);
                }
                byte[] bytes = _textWriter.Encoding.GetBytes(stringBuilder.ToString());
                output.Write(bytes, 0, bytes.Length);
            }
            WordOpenXmlUtils.CopyStream(_stream, output, _stream.Length - num);
        }
Ejemplo n.º 30
0
 public void WriteTableEnd()
 {
     if (this._state == State.InTable)
     {
         this.CurrentTable.WriteCloseTag();
         this._currentTable = this.CurrentTable.ContainingTable;
         if (this.CurrentTable == null)
         {
             this._state = (State)(this._startedInHeaderFooter ? 1 : 0);
         }
         else
         {
             this._state = State.InCell;
         }
         this._depth--;
     }
     else
     {
         WordOpenXmlUtils.FailCodingError();
     }
 }