Exemplo n.º 1
0
 /// <summary>
 /// Converts an <see cref="OpenXmlElement"/> into a <see cref="string"/> representation
 /// of dotnet source code that can be compiled to build <paramref name="element"/>.
 /// </summary>
 /// <param name="element">
 /// The <see cref="OpenXmlElement"/> object to generate source code for.
 /// </param>
 /// <param name="opts">
 /// The <see cref="NamespaceAliasOptions"/> to apply to the resulting source code.
 /// </param>
 /// <param name="provider">
 /// The <see cref="CodeDomProvider"/> object to create the resulting source code.
 /// </param>
 /// <returns>
 /// A <see cref="string"/> representation of the source code generated by
 /// <paramref name="provider"/> that could create <paramref name="element"/> when compiled.
 /// </returns>
 public static string GenerateSourceCode(this OpenXmlElement element, NamespaceAliasOptions opts, CodeDomProvider provider)
 {
     return(element.GenerateSourceCode(new DefaultSerializeSettings(opts), provider));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Converts an <see cref="OpenXmlElement"/> into a <see cref="CodeCompileUnit"/>
 /// object that can be used to build code in a given .NET language that would
 /// build the referenced <see cref="OpenXmlElement"/>.
 /// </summary>
 /// <param name="element">
 /// The <see cref="OpenXmlElement"/> object to generate source code for.
 /// </param>
 /// <param name="opts">
 /// The <see cref="NamespaceAliasOptions"/> to apply to the resulting source code.
 /// </param>
 /// <returns>
 /// A new <see cref="CodeCompileUnit"/> containing the instructions to build
 /// the referenced <see cref="OpenXmlElement"/>.
 /// </returns>
 public static CodeCompileUnit GenerateSourceCode(this OpenXmlElement element, NamespaceAliasOptions opts)
 {
     return(element.GenerateSourceCode(new DefaultSerializeSettings(opts)));
 }
 /// <summary>
 /// Converts an <see cref="OpenXmlPackage"/> into a CodeDom object that can be used
 /// to build code in a given .NET language to build the referenced <paramref name="pkg"/>.
 /// </summary>
 /// <param name="pkg">
 /// The <see cref="OpenXmlPackage"/> object to generate source code for.
 /// </param>
 /// <param name="opts">
 /// The <see cref="NamespaceAliasOptions"/> to apply to the resulting source code.
 /// </param>
 /// <returns>
 /// A new <see cref="CodeCompileUnit"/> containing the instructions to build
 /// the referenced <see cref="OpenXmlPackage"/>.
 /// </returns>
 public static CodeCompileUnit GenerateSourceCode(this OpenXmlPackage pkg, NamespaceAliasOptions opts)
 {
     return pkg.GenerateSourceCode(new DefaultSerializeSettings(opts));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultSerializeSettings"/>
 /// class with the requested <see cref="NamespaceAliasOptions"/> object.
 /// </summary>
 /// <param name="nsAliasOpts"></param>
 public DefaultSerializeSettings(NamespaceAliasOptions nsAliasOpts)
 {
     NamespaceAliasOptions = nsAliasOpts
                             ?? throw new ArgumentNullException(nameof(nsAliasOpts));
 }
 /// <summary>
 /// Converts an <see cref="OpenXmlPackage"/> into a <see cref="string"/> representation
 /// of dotnet source code that can be compiled to build <paramref name="pkg"/>.
 /// </summary>
 /// <param name="pkg">
 /// The <see cref="OpenXmlPackage"/> object to generate source code for.
 /// </param>
 /// <param name="opts">
 /// The <see cref="NamespaceAliasOptions"/> to apply to the resulting source code.
 /// </param>
 /// <param name="provider">
 /// The <see cref="CodeDomProvider"/> object to create the resulting source code.
 /// </param>
 /// <returns>
 /// A <see cref="string"/> representation of the source code generated by <paramref name="provider"/>
 /// that could create <paramref name="pkg"/> when compiled.
 /// </returns>
 public static string GenerateSourceCode(this OpenXmlPackage pkg, NamespaceAliasOptions opts, CodeDomProvider provider)
 {
     return pkg.GenerateSourceCode(new DefaultSerializeSettings(opts), provider);
 }