Ejemplo n.º 1
0
    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");
    }
Ejemplo n.º 2
0
    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");
        sheet.OpenTable("B2:F2").Merge();

        Aceoffix.ExcelWriter.Cell cellB2 = sheet.OpenCell("B2");
        cellB2.Value = "Products for Sale";
        cellB2.HorizontalAlignment = Aceoffix.ExcelWriter.XlHAlign.xlHAlignCenter;
        cellB2.ForeColor           = Color.Red;
        cellB2.Font.Size           = 16;

        sheet.OpenTable("B4:B6").Merge();
        Aceoffix.ExcelWriter.Cell cellB4 = sheet.OpenCell("B4");
        cellB4.Value = "Product A:";
        cellB4.HorizontalAlignment = Aceoffix.ExcelWriter.XlHAlign.xlHAlignCenter;
        cellB4.VerticalAlignment   = Aceoffix.ExcelWriter.XlVAlign.xlVAlignCenter;
        cellB4.ForeColor           = Color.Red;

        sheet.OpenTable("B7:B9").Merge();
        Aceoffix.ExcelWriter.Cell cellB7 = sheet.OpenCell("B7");
        cellB7.Value = "Product B:";
        cellB7.HorizontalAlignment = Aceoffix.ExcelWriter.XlHAlign.xlHAlignCenter;
        cellB7.VerticalAlignment   = Aceoffix.ExcelWriter.XlVAlign.xlVAlignCenter;
        cellB7.ForeColor           = Color.Red;

        AceoffixCtrl1.Bind(wb);
        AceoffixCtrl1.Menubar       = false;
        AceoffixCtrl1.CustomToolbar = false;
        AceoffixCtrl1.OpenDocument("doc/test.xls", Aceoffix.OpenModeType.xlsNormalEdit, "John Scott");
    }
Ejemplo n.º 3
0
    protected void AceoffixCtrl1_Load(object sender, EventArgs e)
    {
        Aceoffix.ExcelWriter.Workbook wb = new Aceoffix.ExcelWriter.Workbook();
        wb.DisableSheetSelection   = true;
        wb.DisableSheetDoubleClick = true;
        AceoffixCtrl1.Caption      = "Work Mode: Read Only; [Disabled Edit, Copy, Paste, Save as, Download, PrintScreen, F12, Context Menu and etc.]";
        AceoffixCtrl1.ServerPage   = "../aceoffix-runtime/server.aspx";

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

        AceoffixCtrl1.AllowCopy = false;                                                                     // Disabled Copy, PrintScreen, F12, Context Menu and etc.
        AceoffixCtrl1.Bind(wb);
        AceoffixCtrl1.OpenDocument("../doc/viewexcel.xls", Aceoffix.OpenModeType.xlsReadOnly, "John Scott"); // docReadOnly: Disabled Edit, Paste.
    }
Ejemplo n.º 4
0
    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.Cell     cellB4 = sheet.OpenCell("B4");
        cellB4.Value = "Jan";
        Aceoffix.ExcelWriter.Cell cellD2 = sheet.OpenCell("D2");
        cellD2.Value = "Sales Report (2015)";
        Aceoffix.ExcelWriter.Cell cellF14 = sheet.OpenCell("F14");
        cellF14.Value = "100%";

        AceoffixCtrl1.Bind(wb);

        AceoffixCtrl1.Menubar       = false;
        AceoffixCtrl1.CustomToolbar = false;
        AceoffixCtrl1.OpenDocument("doc/test.xls", Aceoffix.OpenModeType.xlsNormalEdit, "John Scott");
    }
Ejemplo n.º 5
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");
    }
Ejemplo n.º 6
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");
    }