Exemplo n.º 1
0
        public void SendToWorksheet(Excel.Workbook targetBook, Excel.Worksheet targetSheet)
        {
            Globals.Program.Application.ScreenUpdating = false;
            targetSheet.Activate();
            // reel entries A5~E5, pay at M5
            String col = "A";
            int row = 5;
            int stopCount = 0;
            String cell = col + row.ToString();
            String payCell = "N" + row.ToString();
            int stopSet = m_freeLinePays[0].StopValues.Count - 1;
            bool trim = true;
            String val = "";
            foreach (PaylineDescription line in m_freeLinePays)
            {
                if (line.Win <= 0)
                    continue;
                if (line.IsFreegameSet || line.IsModifierSet || line.HasWild)
                    //continue;
                    if (line.IsFreegameSet || line.IsModifierSet)
                        trim = true;

                col = "A";
                stopCount = 0;
                foreach (String stop in line.StopValues[stopSet].Values)
                {
                    cell = col + row.ToString();
                    if (stopCount == 5)
                        break;
                    stopCount++;
                    if (trim)
                        val = line.StopValues[stopSet].TrimValue(stop);
                    else
                        val = stop;
                    outputCell(targetSheet, cell, val);

                    col = incrementColumn(col);
                }
                payCell = "N" + row.ToString();
                outputCell(targetSheet, payCell, line.Win.ToString());
                row++;
            }
            row = 5;
            foreach (PaylineDescription line in m_freeLinePays)
            {
                if (line.Win <= 0)
                    continue;
                if (line.IsFreegameSet || line.IsModifierSet || line.HasWild)
                    //continue;
                    if (line.IsFreegameSet || line.IsModifierSet)
                        trim = true;

                col = "H";
                stopCount = 0;
                foreach (String stop in line.StopValues[stopSet].Values)
                {
                    cell = col + row.ToString();
                    if (stopCount == 5)
                        break;
                    stopCount++;
                    if (trim)
                        val = line.StopValues[stopSet].TrimValue(stop);
                    else
                        val = stop;
                    outputCell(targetSheet, cell, val);

                    col = incrementColumn(col);
                }
                row++;
            }
            m_rowCount = row;

            Globals.Program.Application.ScreenUpdating = true;

            updatePayLinks(targetBook);
        }
Exemplo n.º 2
0
 private void FreezePanes(Excel.Worksheet worksheet)
 {
     worksheet.Activate();
     worksheet.Application.ActiveWindow.SplitColumn = 3;
     worksheet.Application.ActiveWindow.FreezePanes = true;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Excelシート各種情報取得
        /// </summary>
        private SheetInfo GetSheetInformation(Excel.Worksheet oSheet)
        {
            SheetInfo       info            = null;
            Excel.Range     oCells          = null;
            Excel.Worksheet oActiveSheet    = null;
            Excel.Window    oActiveWindow   = null;

            Debug.Assert(oSheet != null);
            try
            {
                if (oSheet == null)
                {
                    return null;
                }

                // シートをアクティベートする
                oActiveSheet    = (Excel.Worksheet)this._app.ActiveSheet;
                oSheet.Activate();
                oActiveWindow   = this._app.ActiveWindow;
                oCells          = oActiveWindow.ActiveCell;

                // シート情報取得および格納
                info = new SheetInfo();
                {
                    info.Name           = oSheet.Name;
                    info.Zoom           = (double)oActiveWindow.Zoom;
                    info.Gridlines      = oActiveWindow.DisplayGridlines;
                    info.View           = oActiveWindow.View;
                    info.CellPosition = new Point((int)oCells.Column, (int)oCells.Row);
                }
            }
            finally
            {
                if (oActiveSheet != null)
                {
                    oActiveSheet.Activate();
                    Marshal.ReleaseComObject(oActiveSheet);
                }
                oActiveSheet = null;

                if (oActiveWindow != null)
                {
                    Marshal.ReleaseComObject(oActiveWindow);
                }
                oActiveWindow = null;

                if (oCells != null)
                {
                    Marshal.ReleaseComObject(oCells);
                }
                oCells = null;
            }
            return info;
        }
Exemplo n.º 4
0
 public static void FreezePanes(Excel.Worksheet worksheet, int splitColumn, int splitRow)
 {
     worksheet.Activate();
     worksheet.Application.ActiveWindow.SplitColumn = splitColumn;
     worksheet.Application.ActiveWindow.SplitRow = splitRow;
     worksheet.Application.ActiveWindow.FreezePanes = true;
 }
Exemplo n.º 5
0
 private bool checkValue(Excel.Workbook book, Excel.Worksheet sheet, String cell)
 {
     book.Activate();
     if (book.ActiveSheet != sheet)
         sheet.Select();
     Excel.Range test = sheet.get_Range(cell);
     try
     {
         sheet.Select(test);
     }
     catch (Exception e)
     {
         // apparently, an empty cell is not valid for selection.
         return true;
     }
     try
     {
         if (test.Value2 == "" || test.Value2 == null)
             return false;
         else
             return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }