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

XML/XSLT Word Report Generator

Rate me:
Please Sign up or sign in to vote.
3.80/5 (6 votes)
11 Jan 2009CPOL4 min read 123.2K   2.6K   84  
The tool is based on XML/XSLT, and allows a user to create a Word report from scratch, namely: construct SQL query, construct a WordML template, generate a document.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WordReportGenerator
{
    public partial class SqlExecutor : Form
    {
        private WRGEngine engine;
        
        public SqlExecutor(ref Object value){
            InitializeComponent();
            engine = (WRGEngine)value;
            this.Load += new EventHandler(SqlExecutor_Load);
        }

        void SqlExecutor_Load(object sender, EventArgs e){
            this.sql_box.Text = engine.sql;
            this.xml_box.Text = String.Empty;
            this.xsd_box.Text = engine.xsd;
        }

        private void update(){
            this.sql_box.Text = engine.sql;
            this.xml_box.Text = engine.xml;
            this.xsd_box.Text = engine.xsd;
            engine.pg.Refresh();
        }

        private void btn_xml_click(object sender, EventArgs e){
            save();
            engine.xml = (string)WRG.dal.ExecuteScalar(engine.sql);
            update();
        }

        private void btn_xsd_click(object sender, EventArgs e){
            save();
            engine.GetXsd();
            update();
        }

        private void btn_save_click(object sender, EventArgs e){
            save();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btn_cancel_click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void save(){
            engine.sql = this.sql_box.Text;
            engine.xml = this.xml_box.Text;
            engine.xsd = this.xsd_box.Text;
        }
    }
}

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
Software Developer
Russian Federation Russian Federation
I have Master degree in Particle Physics. During my last several years I work as software developer.

Primary Interests
- c#, c++, php, java.
- scientific programming

Comments and Discussions