/// <summary> /// Converts FormattedText into DDL. /// </summary> internal override void Serialize(Serializer serializer) { bool isFormatted = false; if (!IsNull("Font")) { Font.Serialize(serializer); isFormatted = true; } else { if (!_style.IsNull) { serializer.Write("\\font(\"" + Style + "\")"); isFormatted = true; } } if (isFormatted) { serializer.Write("{"); } if (!IsNull("Elements")) { Elements.Serialize(serializer); } if (isFormatted) { serializer.Write("}"); } }
/// <summary> /// Converts Hyperlink into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (_name.Value == string.Empty) { throw new InvalidOperationException(DomSR.MissingObligatoryProperty("Name", "Hyperlink")); } serializer.Write("\\hyperlink"); string str = "[Name = \"" + Name.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""; if (!_type.IsNull) { str += " Type = " + Type; } str += "]"; serializer.Write(str); serializer.Write("{"); if (_elements != null) { _elements.Serialize(serializer); } serializer.Write("}"); }
/// <summary> /// Converts Hyperlink into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.Write("\\hyperlink"); var str = "["; if (Type == HyperlinkType.ExternalBookmark || Type == HyperlinkType.File || Type == HyperlinkType.Url) { if (_filename.Value == string.Empty) { throw new InvalidOperationException(DomSR.MissingObligatoryProperty("Filename", $"Hyperlink {Type.ToString()}")); } str += " Filename = \"" + Filename.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""; } if (Type == HyperlinkType.ExternalBookmark || Type == HyperlinkType.Bookmark || Type == HyperlinkType.EmbeddedDocument) { if (_bookmarkName.Value == string.Empty) { throw new InvalidOperationException(DomSR.MissingObligatoryProperty("BookmarkName", $"Hyperlink {Type.ToString()}")); } str += " BookmarkName = \"" + BookmarkName.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""; } if (Type == HyperlinkType.ExternalBookmark || Type == HyperlinkType.EmbeddedDocument) { str += " NewWindow = " + NewWindow; } if (!_type.IsNull) { str += " Type = " + Type; } str += "]"; serializer.Write(str); serializer.Write("{"); if (_elements != null) { _elements.Serialize(serializer); } serializer.Write("}"); }