//複製資料 Excel.Range srcRange = wsSrc.Rows[target.Row] as Excel.Range; Excel.Range destRange = wsDest.Rows[dest.Row] as Excel.Range; destRange.Value2 = srcRange.Value2;
//複製無formulas Object template = Settings.Default.TemplatePath; Workbook wb = Globals.ThisAddIn.Application.Workbooks.Add(template) as Workbook; Excel.Range r = (Excel.Range)wb.Application.ActiveCell[1, "A"]; const int xlShiftDown = -4121; Excel.Range oRow = r.EntireRow; oRow.Insert(xlShiftDown, Excel.XlInsertFormatOrigin.xlFormatFromRightOrBelow);
//複製有formulas Object template = Settings.Default.TemplatePath; Excel.Workbook wb = Globals.ThisAddIn.Application.Workbooks.Add(template) as Excel.Workbook; Excel.Range r = (Excel.Range)wb.Application.ActiveCell[1, "A"]; Excel.Range oRow = r.EntireRow; oRow.Select(); oRow.Copy(); Excel.Range rg = (Excel.Range)rg[2, "A"]; rg.Select(); rg.PasteSpecial(Excel.XlPasteType.xlPasteAll, Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone, Type.Missing, Type.Missing); wb.Application.CutCopyMode = Excel.XlCutCopyMode.xlCopy;
沒有留言:
張貼留言