예제 #1
0
파일: Document.cs 프로젝트: zbjxb/MigraDoc
        /// <summary>
        /// Converts Document into DDL.
        /// </summary>
        internal override void Serialize(Serializer serializer)
        {
            serializer.WriteComment(_comment.Value);
            serializer.WriteLine("\\document");

            int pos = serializer.BeginAttributes();

            if (!IsNull("Info"))
            {
                Info.Serialize(serializer);
            }
            if (!_defaultTabStop.IsNull)
            {
                serializer.WriteSimpleAttribute("DefaultTabStop", DefaultTabStop);
            }
            if (!_footnoteLocation.IsNull)
            {
                serializer.WriteSimpleAttribute("FootnoteLocation", FootnoteLocation);
            }
            if (!_footnoteNumberingRule.IsNull)
            {
                serializer.WriteSimpleAttribute("FootnoteNumberingRule", FootnoteNumberingRule);
            }
            if (!_footnoteNumberStyle.IsNull)
            {
                serializer.WriteSimpleAttribute("FootnoteNumberStyle", FootnoteNumberStyle);
            }
            if (!_footnoteStartingNumber.IsNull)
            {
                serializer.WriteSimpleAttribute("FootnoteStartingNumber", FootnoteStartingNumber);
            }
            if (!_imagePath.IsNull)
            {
                serializer.WriteSimpleAttribute("ImagePath", ImagePath);
            }
            if (!_useCmykColor.IsNull)
            {
                serializer.WriteSimpleAttribute("UseCmykColor", UseCmykColor);
            }
            serializer.EndAttributes(pos);

            serializer.BeginContent();
            if (!IsNull("EmbeddedFiles"))
            {
                EmbeddedFiles.Serialize(serializer);
            }

            Styles.Serialize(serializer);

            if (!IsNull("Sections"))
            {
                Sections.Serialize(serializer);
            }
            serializer.EndContent();
            serializer.Flush();
        }
예제 #2
0
파일: Document.cs 프로젝트: zbjxb/MigraDoc
 /// <summary>
 /// Adds an embedded file to the document.
 /// </summary>
 /// <param name="name">The name used to refer and to entitle the embedded file.</param>
 /// <param name="path">The path of the file to embed.</param>
 public void AddEmbeddedFile(string name, string path)
 {
     EmbeddedFiles.Add(name, path);
 }