本文整理汇总了C#中Microsoft.Office.Interop.Excel.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Excel.Activate方法的具体用法?C# Microsoft.Office.Interop.Excel.Activate怎么用?C# Microsoft.Office.Interop.Excel.Activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.Excel
的用法示例。
在下文中一共展示了Microsoft.Office.Interop.Excel.Activate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendToWorksheet
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);
}
示例2: FreezePanes
private void FreezePanes(Excel.Worksheet worksheet)
{
worksheet.Activate();
worksheet.Application.ActiveWindow.SplitColumn = 3;
worksheet.Application.ActiveWindow.FreezePanes = true;
}
示例3: GetSheetInformation
/// <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;
}
示例4: FreezePanes
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;
}
示例5: checkValue
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;
}
}