//近接セルから値を取得 private void near_cell_copy_wrapper(string vector) { try { Excel.Range sa = Globals.ThisAddIn.Application.ActiveCell; Excel.Worksheet ash = Globals.ThisAddIn.Application.ActiveSheet; Excel.Areas areas = Globals.ThisAddIn.Application.Selection.Areas; List <string> selectionList = new List <string>(); foreach (Excel.Range item in areas) { selectionList.Add(item.Address); } ash.Range[selectionList[0]].Select(); for (int i = 0; i < selectionList.Count; i++) { ash.Range[selectionList[i]].Select(); near_cell_copy(vector); } } catch (Exception ex) { MessageBox.Show("エラー:" + ex.Message); } }
//判定ひな形を作成(Libra) private void lb_sv_base_wrap() { if (frmObj.Visible == false) { frmObj.Show(); } if (get_survey_base_body != "") { get_survey_base_body = ""; } Excel.Range sa = Globals.ThisAddIn.Application.ActiveCell; Excel.Worksheet ash = Globals.ThisAddIn.Application.ActiveSheet; Excel.Areas areas = Globals.ThisAddIn.Application.Selection.Areas; List <string> selectionList = new List <string>(); foreach (Excel.Range item in areas) { selectionList.Add(item.Address); } ash.Range[selectionList[0]].Select(); for (int i = 0; i < selectionList.Count; i++) { ash.Range[selectionList[i]].Select(); lb_sv_base(); } frmObj.reportText.Clear(); frmObj.setTitle("判定ひな形を生成"); frmObj.reportText.Text = get_survey_base_body; frmObj.WindowState = FormWindowState.Normal; frmObj.Activate(); }
//判定結果を整形表示(LibraPlus) private void lbps_sv_disp_wrap() { if (get_wa_check_comment_base_body != "") { get_wa_check_comment_base_body = ""; } if (dpfrmObj.Visible == false) { dpfrmObj.Show(); } Excel.Range sa = Globals.ThisAddIn.Application.ActiveCell; Excel.Worksheet ash = Globals.ThisAddIn.Application.ActiveSheet; Excel.Areas areas = Globals.ThisAddIn.Application.Selection.Areas; List <string> selectionList = new List <string>(); foreach (Excel.Range item in areas) { selectionList.Add(item.Address); } ash.Range[selectionList[0]].Select(); for (int i = 0; i < selectionList.Count; i++) { ash.Range[selectionList[i]].Select(); lbps_sv_disp(); } dpfrmObj.ContentTextBox.Clear(); dpfrmObj.ContentTextBox.Text = get_wa_check_comment_base_body; dpfrmObj.WindowState = FormWindowState.Normal; dpfrmObj.Activate(); dpfrmObj.ContentTextBox.Select(0, 0); }
private void button4_Click(object sender, EventArgs e) { string _strFileName = @"r:\abcd.xls"; MSOffice.Application App = new MSOffice.Application(); MSOffice.Workbook Book = App.Workbooks.Add(MSOffice.XlWBATemplate.xlWBATWorksheet); MSOffice.Worksheet Sheet = (MSOffice.Worksheet)Book.ActiveSheet; MSOffice.Worksheets sheets = (MSOffice.Worksheets)Book.Sheets; App.Visible = false; App.DisplayAlerts = false; object obj = App.Caller[1]; obj = App.Charts; obj = App.ClipboardFormats; obj = App.CutCopyMode; obj = App.StatusBar; obj = App.Workbooks[1]; obj = Book.ActiveChart; obj = Sheet.PageSetup.FirstPage.CenterFooter.Picture.Application; obj = Sheet.Range["", ""].Font.Application; obj = Sheet.Range["", ""].Borders[MSOffice.XlBordersIndex.xlDiagonalUp].Application; obj = App.Windows[""].SheetViews[""]; obj = App.Charts; obj = Sheet.Names; obj = Sheet.Names.Item(1); Sheet.Copy(); MSOffice.Areas a = null; obj = a.Application; // MSOffice.Hyperlink App.Workbooks.Open(""); // _xlsApp.Selection App.Windows[1].Zoom = 150; //xlsSheet.Rows[1, 1]; MSOffice.Range rng = Sheet.Range[1, 2]; MSOffice.Shape shape = Sheet.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 48, 72, 60); shape.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse; shape.Shadow.Obscured = Microsoft.Office.Core.MsoTriState.msoCTrue; shape.Shadow.Type = Microsoft.Office.Core.MsoShadowType.msoShadow18; shape.Fill.UserPicture(@"r:\test.jpg"); //xlsSheet.Shapes.AddOLEObject //shape.GroupItems.Item //shape.Glow.Color Sheet.get_Range(""); App.Windows[1].Height = 100; textBox1.Text = App.Version; App.Quit(); }
//色付け決め打ち private void do_static_cell_coloring_wrapper(string operation) { Excel.Range sa = Globals.ThisAddIn.Application.ActiveCell; Excel.Worksheet ash = Globals.ThisAddIn.Application.ActiveSheet; Excel.Areas areas = Globals.ThisAddIn.Application.Selection.Areas; List <int[]> arr = _get_color_rgb_list(); int[] cr_row = null; switch (operation) { case "blue": cr_row = arr[0]; break; case "green": cr_row = arr[1]; break; case "pink": cr_row = arr[2]; break; case "purple": cr_row = arr[3]; break; case "yellow": cr_row = arr[4]; break; case "red": cr_row = arr[5]; break; } List <string> selectionList = new List <string>(); foreach (Excel.Range item in areas) { selectionList.Add(item.Address); } ash.Range[selectionList[0]].Select(); for (int i = 0; i < selectionList.Count; i++) { ash.Range[selectionList[i]].Select(); do_static_cell_coloring(cr_row); } }
//折り返し private void do_cell_linebreak_wrapper() { Excel.Range sa = Globals.ThisAddIn.Application.ActiveCell; Excel.Worksheet ash = Globals.ThisAddIn.Application.ActiveSheet; Excel.Areas areas = Globals.ThisAddIn.Application.Selection.Areas; List <string> selectionList = new List <string>(); foreach (Excel.Range item in areas) { selectionList.Add(item.Address); } ash.Range[selectionList[0]].Select(); for (int i = 0; i < selectionList.Count; i++) { ash.Range[selectionList[i]].Select(); do_cell_linebreak(); } }
//選択範囲のURLのセルの隣列にページタイトル取得 private void do_page_title_add_wrapper() { Excel.Range sa = Globals.ThisAddIn.Application.ActiveCell; Excel.Worksheet ash = Globals.ThisAddIn.Application.ActiveSheet; Excel.Areas areas = Globals.ThisAddIn.Application.Selection.Areas; List <string> selectionList = new List <string>(); foreach (Excel.Range item in areas) { selectionList.Add(item.Address); } ash.Range[selectionList[0]].Select(); for (int i = 0; i < selectionList.Count; i++) { ash.Range[selectionList[i]].Select(); do_page_title_add(); } MessageBox.Show("ページタイトル取得が完了しました!"); }