//Usings using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Office.Interop.Excel; using System.Globalization; Workbooks libro = Excel.Workbooks; Workbook libroActual = libro.Add(); Sheets sheets = libroActual.Worksheets; Microsoft.Office.Interop.Excel._Worksheet Worksheet = libroActual.ActiveSheet; Worksheet.Name = "Desglose"; // Operations here with sheed 1 Worksheet sheetMMPP = sheets.Add(); sheetMMPP.Name = "MMPP"; //Range of the origin sheet Microsoft.Office.Interop.Excel.Range oRange = Worksheet.UsedRange; Microsoft.Office.Interop.Excel.Range oRange2 = sheetMMPP.Cells[1, 1]; Microsoft.Office.Interop.Excel.PivotCache oPivotCache = (Microsoft.Office.Interop.Excel.PivotCache)libroActual.PivotCaches().Add(Microsoft.Office.Interop.Excel.XlPivotTableSourceType.xlDatabase, oRange2); Microsoft.Office.Interop.Excel.PivotCaches pch = libroActual.PivotCaches(); Microsoft.Office.Interop.Excel.PivotTable pvt = sheetMMPP.PivotTables("PivTbl_1") as Microsoft.Office.Interop.Excel.PivotTable;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)