Exemple #1
0
    //public DxDoc(DxChartFactory factory, string projtitle, string datafile, string netid)
    //{
    //	_creator_netid = netid;
    //	//Document doc = new DevExpress.XtraRichEdit.API.Native.Document();
    //}



    //public DxDoc(List<DxChartOrder> ordersC, string path, string projtitle, string datafile, string netid)
    //{
    //	_creator_netid = netid;
    //	_temppath = path;
    //	_projtitle = projtitle;
    //	_datafile = datafile;
    //	_filename = "test.docx"; // filename;

    //	MakeDocx(ordersC);

    //	//Document doc = new DevExpress.XtraRichEdit.API.Native.Document();
    //}



    //public DxDoc(DataTable dt_plots, List<string> htmltables, string path, string filename, string projtitle, string datafile, string netid)
    //{
    //	_creator_netid = netid;
    //	_temppath = path;
    //	_projtitle = projtitle;
    //	_datafile = datafile;
    //	_filename = filename;

    //	MakeDocx(dt_plots, htmltables);

    //	//Document doc = new DevExpress.XtraRichEdit.API.Native.Document();
    //}

    //public DxDoc(DataTable dt_plots, DataTable dt_tables, string path, string filename, string projtitle, string datafile, string netid)
    //{
    //	_creator_netid = netid;
    //	_temppath = path;
    //	_projtitle = projtitle;
    //	_datafile = datafile;
    //	_filename = filename;

    //	MakeDocx(dt_plots, dt_tables);

    //	//Document doc = new DevExpress.XtraRichEdit.API.Native.Document();
    //}
    #endregion


    protected void DocxHeader(DevExpress.XtraRichEdit.API.Native.Document doc, string s1, string s2)
    {
        DevExpress.XtraRichEdit.API.Native.Section firstSection = doc.Sections[0];
        // Create an empty header.
        SubDocument newHeader = firstSection.BeginUpdateHeader();

        firstSection.EndUpdateHeader(newHeader);
        // Check whether the document already has a header (the same header for all pages).
        if (firstSection.HasHeader(DevExpress.XtraRichEdit.API.Native.HeaderFooterType.Primary))
        {
            SubDocument myHeader = firstSection.BeginUpdateHeader();
            doc.ChangeActiveDocument(myHeader);
            doc.CaretPosition = myHeader.CreatePosition(0);

            string        txt   = String.Format("{0}     p.", s1);
            DocumentRange range = myHeader.InsertText(myHeader.CreatePosition(0), txt);
            Field         fld   = myHeader.Fields.Create(range.End, "PAGE");   //  "PAGE \\* ARABICDASH");
            myHeader.Fields.Update();

            myHeader.Paragraphs.Append();
            string user_time = String.Format("{0}     {1:MM/dd/yy H:mm}", _creator_netid, System.DateTime.Now);
            myHeader.AppendText(String.Format("{0}                             {1}", s2, user_time));


            firstSection.EndUpdateHeader(myHeader);
        }
    }
        private void InitializeLogStream()
        {
            recLogStream.ActiveViewType       = (RichEditViewType)cbeRichEditViewType.SelectedIndex;
            recLogStream.ActiveView.BackColor = System.Drawing.Color.Black;

            Document doc = recLogStream.Document;

            DevExpress.XtraRichEdit.API.Native.Section section = doc.Sections[0];

            section.Page.PaperKind = System.Drawing.Printing.PaperKind.B4;
            section.Page.Landscape = true;
            section.Margins.Left   = 0.1f;
            section.Margins.Right  = 0.1f;
        }