protected void Page_Load(object sender, EventArgs e)
    {
        AceoffixCtrl1.ServerPage = "../aceoffix-runtime/server.aspx";

        Aceoffix.ExcelWriter.Workbook wb    = new Aceoffix.ExcelWriter.Workbook();
        Aceoffix.ExcelWriter.Sheet    sheet = wb.OpenSheet("Sheet1");
        Aceoffix.ExcelWriter.Table    table = sheet.OpenTable("B4:F13");

        for (int i = 0; i < 50; i++)
        {
            table.DataFields[0].Value = "Product:" + i.ToString();
            table.DataFields[1].Value = "100";
            table.DataFields[2].Value = (100 + i).ToString();
            table.NextRow();
        }
        table.Close();


        sheet.OpenCell("F4").Value = string.Format("{0:P}", 270.0 / 300);
        AceoffixCtrl1.Bind(wb);

        AceoffixCtrl1.Menubar       = false;
        AceoffixCtrl1.CustomToolbar = false;
        AceoffixCtrl1.OpenDocument("doc/test.xls", Aceoffix.OpenModeType.xlsNormalEdit, "John Scott");
    }
Beispiel #2
0
    protected void AceoffixCtrl1_Load(object sender, EventArgs e)
    {
        Aceoffix.ExcelWriter.Workbook wb     = new Aceoffix.ExcelWriter.Workbook();
        Aceoffix.ExcelWriter.Sheet    sheet1 = wb.OpenSheet("Purchase Order");

        System.Random rd = new Random(System.DateTime.Now.Millisecond);
        sheet1.OpenCell("D8").Value    = "XYZ-11-" + (10001 + rd.Next(10000)).ToString();
        sheet1.OpenCell("D8").ReadOnly = true;

        Aceoffix.ExcelWriter.Cell cellDate = sheet1.OpenCell("I6");
        string dt = DateTime.Now.ToString();

        cellDate.Value = dt;
        sheet1.OpenCell("J31").Value = dt;

        sheet1.OpenCell("D15").ReadOnly = false; // Enabled edit

        Aceoffix.ExcelWriter.Table table1 = sheet1.OpenTable("B18:J23");
        table1.ReadOnly = false; // Enabled edit

        sheet1.OpenCell("J24").ReadOnly = true;
        sheet1.OpenCell("J26").ReadOnly = true;
        sheet1.OpenCell("J28").ReadOnly = true;

        sheet1.OpenCell("G31").Value = "John Scott";

        AceoffixCtrl1.Caption    = "Excel spreadsheet used as an input form.";
        AceoffixCtrl1.ServerPage = "../aceoffix-runtime/server.aspx";

        // Create custom toolbar
        AceoffixCtrl1.AddCustomToolButton("Save", "SaveDocument()", 1);
        AceoffixCtrl1.AddCustomToolButton("-", "", 0);
        AceoffixCtrl1.AddCustomToolButton("Print", "ShowPrintDlg()", 6);
        AceoffixCtrl1.AddCustomToolButton("-", "", 0);
        AceoffixCtrl1.AddCustomToolButton("Full-screen Switch", "SwitchFullScreen()", 4);

        AceoffixCtrl1.Bind(wb);
        AceoffixCtrl1.SaveDataPage = "saveexceldata.aspx";
        AceoffixCtrl1.OpenDocument("../doc/xls-submit.xls", Aceoffix.OpenModeType.xlsSubmitForm, "John Scott");
    }
Beispiel #3
0
    protected void AceoffixCtrl1_Load(object sender, EventArgs e)
    {
        Aceoffix.ExcelWriter.Workbook wb     = new Aceoffix.ExcelWriter.Workbook();
        Aceoffix.ExcelWriter.Sheet    sheet1 = wb.OpenSheet("Sheet1");
        Aceoffix.ExcelWriter.Table    table1 = sheet1.OpenTable("C5:E16");

        //Output data into the table.
        System.Random rd = new Random(System.DateTime.Now.Millisecond);
        for (int j = 0; j < 12; j++)
        {
            for (int i = 0; i < table1.DataFields.Count; i++)
            {
                int iValue = (rd.Next(25) + 10) * 1000;
                table1.DataFields[i].Value = iValue.ToString(); // You can set the data from the database.
                if (iValue > 30 * 1000)                         // If the value is greater than 30*1000, then the cell will display alert style to warn the user.
                {
                    table1.DataFields[i].BackColor = System.Drawing.Color.Red;
                    table1.DataFields[i].ForeColor = System.Drawing.Color.Yellow;
                }
            }
            table1.NextRow();
        }
        table1.Close();

        AceoffixCtrl1.ServerPage = "../aceoffix-runtime/server.aspx";
        AceoffixCtrl1.Caption    = "Subject: Usage of Excel Table [Double click the title bar to enter/exit full screen]";
        AceoffixCtrl1.Bind(wb);

        // Create custom toolbar
        AceoffixCtrl1.AddCustomToolButton("Save As", "SaveAsDocument()", 1);
        AceoffixCtrl1.AddCustomToolButton("-", "", 0);
        AceoffixCtrl1.AddCustomToolButton("Page Setup", "ShowPageSetupDlg()", 0);
        AceoffixCtrl1.AddCustomToolButton("Print", "ShowPrintDlg()", 6);
        AceoffixCtrl1.AddCustomToolButton("-", "", 0);
        AceoffixCtrl1.AddCustomToolButton("Full-screen Switch", "SwitchFullScreen()", 4);

        AceoffixCtrl1.FileTitle = "Report1";
        AceoffixCtrl1.OpenDocument("../doc/xls-report.xls", Aceoffix.OpenModeType.xlsReadOnly, "John Scott");
    }