Пример #1
0
        protected void ctrlWordPrint2_Print(WordPrintDataSourceCollection DataSourceList)
        {
            DataTable           dtTrans1     = ViewState["dtTrans1"] as DataTable;
            WordPrintDataSource dsWordPrint1 = new WordPrintDataSource("dsWordPrint1", (IEnumerable)dtTrans1.DefaultView);
            DataTable           dtTrans2     = ViewState["dtTrans2"] as DataTable;
            WordPrintDataSource dsWordPrint2 = new WordPrintDataSource("dsWordPrint2", (IEnumerable)dtTrans2.DefaultView);
            DataTable           dtTrans3     = ViewState["dtTrans3"] as DataTable;
            WordPrintDataSource dsWordPrint3 = new WordPrintDataSource("dsWordPrint3", (IEnumerable)dtTrans3.DefaultView);

            DataSourceList.Add(dsWordPrint1);
            DataSourceList.Add(dsWordPrint2);
            DataSourceList.Add(dsWordPrint3);
        }
Пример #2
0
        protected void WordPrint1_OnPrint(WordPrintDataSourceCollection DataSourceList)
        {
            DataTable Dt = new DataTable();

            Dt.Columns.Add("ID", typeof(string));
            Dt.Columns.Add("Text", typeof(string));

            DataRow newRow;


            newRow         = Dt.NewRow();
            newRow["ID"]   = "我就是AA中的ID";
            newRow["Text"] = "我就是AA中的Text";
            Dt.Rows.Add(newRow);

            WordPrintDataSource aa = new WordPrintDataSource("aa", (IEnumerable)Dt.DefaultView);


            DataTable Dt2 = new DataTable();

            Dt2.Columns.Add("ID2", typeof(string));
            Dt2.Columns.Add("Text2", typeof(string));

            //DataRow newRow;

            newRow          = Dt2.NewRow();
            newRow["ID2"]   = "我就是BB中的ID";
            newRow["Text2"] = "我就是BB中的Text";
            Dt2.Rows.Add(newRow);


            WordPrintDataSource bb = new WordPrintDataSource("bb", (IEnumerable)Dt2.DefaultView);

            DataTable Dt3 = new DataTable();

            Dt3.Columns.Add("ID3", typeof(string));
            Dt3.Columns.Add("Text3", typeof(string));


            newRow          = Dt3.NewRow();
            newRow["ID3"]   = "1";
            newRow["Text3"] = "http://localhost:2032/WordPrint/doc2.doc";
            Dt3.Rows.Add(newRow);

            WordPrintDataSource cc = new WordPrintDataSource("cc", (IEnumerable)Dt3.DefaultView);

            DataSourceList.Add(aa);
            DataSourceList.Add(bb);
            DataSourceList.Add(cc);
        }