Click here to Skip to main content
15,881,803 members
Articles / Productivity Apps and Services / Microsoft Office

Creation of a Word 2007 document using the Open XML Format SDK

Rate me:
Please Sign up or sign in to vote.
4.92/5 (24 votes)
24 May 2009CPOL5 min read 164.6K   4.7K   72  
A simple “getting started” article that shows the basis of creation of a Word 2007 (docx) document using the Open XML Format SDK 2.0 CTP.
namespace OpenXML_SDK_HelloWorld
{
  partial class Form1
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.button1 = new System.Windows.Forms.Button();
      this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
      this.button2 = new System.Windows.Forms.Button();
      this.button_sampletable = new System.Windows.Forms.Button();
      this.button_simpeltable = new System.Windows.Forms.Button();
      this.SuspendLayout();
      // 
      // button1
      // 
      this.button1.Location = new System.Drawing.Point(54, 41);
      this.button1.Name = "button1";
      this.button1.Size = new System.Drawing.Size(125, 23);
      this.button1.TabIndex = 0;
      this.button1.Text = "Hello World!";
      this.button1.UseVisualStyleBackColor = true;
      this.button1.Click += new System.EventHandler(this.button1_Click);
      // 
      // saveFileDialog1
      // 
      this.saveFileDialog1.Filter = "DOCX|*.docx";
      // 
      // button2
      // 
      this.button2.Location = new System.Drawing.Point(54, 70);
      this.button2.Name = "button2";
      this.button2.Size = new System.Drawing.Size(125, 23);
      this.button2.TabIndex = 0;
      this.button2.Text = "Hello World with styles!";
      this.button2.UseVisualStyleBackColor = true;
      this.button2.Click += new System.EventHandler(this.button_helloworldwithstyles_Click);
      // 
      // button_sampletable
      // 
      this.button_sampletable.Location = new System.Drawing.Point(54, 130);
      this.button_sampletable.Name = "button_sampletable";
      this.button_sampletable.Size = new System.Drawing.Size(125, 45);
      this.button_sampletable.TabIndex = 0;
      this.button_sampletable.Text = "Sample Table: Multiplication table";
      this.button_sampletable.UseVisualStyleBackColor = true;
      this.button_sampletable.Click += new System.EventHandler(this.button_sampletable_Click);
      // 
      // button_simpeltable
      // 
      this.button_simpeltable.Location = new System.Drawing.Point(54, 99);
      this.button_simpeltable.Name = "button_simpeltable";
      this.button_simpeltable.Size = new System.Drawing.Size(125, 23);
      this.button_simpeltable.TabIndex = 0;
      this.button_simpeltable.Text = "The simplest table";
      this.button_simpeltable.UseVisualStyleBackColor = true;
      this.button_simpeltable.Click += new System.EventHandler(this.button_thesimplesttable_Click);
      // 
      // Form1
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(292, 266);
      this.Controls.Add(this.button_sampletable);
      this.Controls.Add(this.button_simpeltable);
      this.Controls.Add(this.button2);
      this.Controls.Add(this.button1);
      this.Name = "Form1";
      this.Text = "OpenXML_SDK_HelloWorld";
      this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.SaveFileDialog saveFileDialog1;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.Button button_sampletable;
    private System.Windows.Forms.Button button_simpeltable;
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Poland Poland

I am software developer and architect. I am interested in real-time systems programming, communication systems and new technologies.


For readers from Poland I suggest to visit my blog: http://maciej-progtech.blogspot.com/ to find interesting resources.


Comments and Discussions