File tree Expand file tree Collapse file tree 17 files changed +35
-135
lines changed 
Calculated Field/.NET/Calculated Field/Calculated Field 
Classic Layout/.NET/Classic Layout/Classic Layout 
Compact Layout/.NET/Compact Layout/Compact Layout 
Create Pivot Table/.NET/Create Pivot Table/Create Pivot Table 
Dynamic Refresh/.NET/Dynamic Refresh/Dynamic Refresh 
Edit Pivot Table/.NET/Edit Pivot Table/Edit Pivot Table 
Expand or Collapse Pivot Rows/.NET/Expand or Collapse Pivot Rows/Expand or Collapse Pivot Rows 
Format Pivot Cell/.NET/Format Pivot Cell/Format Pivot Cell 
Format Pivot Table/.NET/Format Pivot Table/Format Pivot Table 
Layout/.NET/Layout/Layout 
Outline Layout/.NET/Outline Layout/Outline Layout 
Pivot Filter/.NET/Pivot Filter/Pivot Filter 
Refresh Pivot Table/.NET/Refresh Pivot Table/Refresh Pivot Table 
Remove Pivot Table/.NET/Remove Pivot Table/Remove Pivot Table 
Sort Left to Right/.NET/Sort Left to Right/Sort Left to Right 
Sort Top to Bottom/.NET/Sort Top to Bottom/Sort Top to Bottom 
Tabular Layout/.NET/Tabular Layout/Tabular Layout Expand file tree Collapse file tree 17 files changed +35
-135
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ static void Main(string[] args)
1111            { 
1212                IApplication  application  =  excelEngine . Excel ; 
1313                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
14-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
15-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
14+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1615                IWorksheet  sheet  =  workbook . Worksheets [ 1 ] ; 
1716                IPivotTable  pivotTable  =  sheet . PivotTables [ 0 ] ; 
1817
@@ -24,13 +23,8 @@ static void Main(string[] args)
2423
2524                #region Save
2625                //Saving the workbook 
27-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/CalculatedField.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
28-                 workbook . SaveAs ( outputStream ) ; 
26+                 workbook . SaveAs ( Path . GetFullPath ( "Output/CalculatedField.xlsx" ) ) ; 
2927                #endregion
30- 
31-                 //Dispose streams 
32-                 outputStream . Dispose ( ) ; 
33-                 inputStream . Dispose ( ) ; 
3428            } 
3529        } 
3630    } 
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ static void Main(string[] args)
1212            { 
1313                IApplication  application  =  excelEngine . Excel ; 
1414                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
15-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
16-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
15+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1716                IWorksheet  worksheet  =  workbook . Worksheets [ 1 ] ; 
1817                IPivotTable  pivotTable  =  worksheet . PivotTables [ 0 ] ; 
1918
@@ -22,13 +21,8 @@ static void Main(string[] args)
2221
2322                #region Save
2423                //Saving the workbook 
25-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/ClassicLayout.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
26-                 workbook . SaveAs ( outputStream ) ; 
24+                 workbook . SaveAs ( Path . GetFullPath ( "Output/ClassicLayout.xlsx" ) ) ; 
2725                #endregion
28- 
29-                 //Dispose streams 
30-                 outputStream . Dispose ( ) ; 
31-                 inputStream . Dispose ( ) ; 
3226            } 
3327        } 
3428    } 
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ public static void Main(string[] args)
1111            { 
1212                IApplication  application  =  excelEngine . Excel ; 
1313                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
14-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
15-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
14+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1615                IWorksheet  worksheet  =  workbook . Worksheets [ 1 ] ; 
1716                IPivotTable  pivotTable  =  worksheet . PivotTables [ 0 ] ; 
1817
@@ -24,13 +23,8 @@ public static void Main(string[] args)
2423
2524                #region Save
2625                //Saving the workbook 
27-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/Output.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
28-                 workbook . SaveAs ( outputStream ) ; 
26+                 workbook . SaveAs ( Path . GetFullPath ( "Output/Output.xlsx" ) ) ; 
2927                #endregion
30- 
31-                 //Dispose streams 
32-                 outputStream . Dispose ( ) ; 
33-                 inputStream . Dispose ( ) ; 
3428            } 
3529        } 
3630    } 
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ static void Main(string[] args)
1111            { 
1212                IApplication  application  =  excelEngine . Excel ; 
1313                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
14-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/PivotData.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
15-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
14+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/PivotData.xlsx" ) ) ; 
1615                IWorksheet  worksheet  =  workbook . Worksheets [ 0 ] ; 
1716                IWorksheet  pivotSheet  =  workbook . Worksheets [ 1 ] ; 
1817
@@ -33,13 +32,8 @@ static void Main(string[] args)
3332
3433                #region Save
3534                //Saving the workbook 
36-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/PivotTable.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
37-                 workbook . SaveAs ( outputStream ) ; 
35+                 workbook . SaveAs ( Path . GetFullPath ( "Output/PivotTable.xlsx" ) ) ; 
3836                #endregion
39- 
40-                 //Dispose streams 
41-                 outputStream . Dispose ( ) ; 
42-                 inputStream . Dispose ( ) ; 
4337            } 
4438        } 
4539    } 
Original file line number Diff line number Diff line change @@ -11,22 +11,16 @@ static void Main(string[] args)
1111            { 
1212                IApplication  application  =  excelEngine . Excel ; 
1313                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
14-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
15-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
14+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1615                IWorksheet  pivotSheet  =  workbook . Worksheets [ 0 ] ; 
1716
1817                //Change the range values that the Pivot Tables range refers to 
1918                workbook . Names [ "PivotRange" ] . RefersToRange  =  pivotSheet . Range [ "A1:H25" ] ; 
2019
2120                #region Save
2221                //Saving the workbook 
23-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/PivotTable.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
24-                 workbook . SaveAs ( outputStream ) ; 
22+                 workbook . SaveAs ( Path . GetFullPath ( "Output/PivotTable.xlsx" ) ) ; 
2523                #endregion
26- 
27-                 //Dispose streams 
28-                 outputStream . Dispose ( ) ; 
29-                 inputStream . Dispose ( ) ; 
3024            } 
3125        } 
3226    } 
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ static void Main(string[] args)
1212            { 
1313                IApplication  application  =  excelEngine . Excel ; 
1414                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
15-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
16-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
15+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1716                IWorksheet  worksheet  =  workbook . Worksheets [ 1 ] ; 
1817
1918                //Accessing the pivot table in the worksheet 
@@ -27,13 +26,8 @@ static void Main(string[] args)
2726
2827                #region Save
2928                //Saving the workbook 
30-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/Output.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
31-                 workbook . SaveAs ( outputStream ) ; 
29+                 workbook . SaveAs ( Path . GetFullPath ( "Output/Output.xlsx" ) ) ; 
3230                #endregion
33- 
34-                 //Dispose streams 
35-                 outputStream . Dispose ( ) ; 
36-                 inputStream . Dispose ( ) ; 
3731            } 
3832        } 
3933    } 
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ static void Main(string[] args)
1212            { 
1313                IApplication  application  =  excelEngine . Excel ; 
1414                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
15-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
16-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
15+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1716                IWorksheet  worksheet  =  workbook . Worksheets [ 0 ] ; 
1817                IWorksheet  pivotSheet  =  workbook . Worksheets [ 1 ] ; 
1918
@@ -41,13 +40,8 @@ static void Main(string[] args)
4140
4241                #region Save
4342                //Saving the workbook 
44-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/ExpandOrCollapse.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
45-                 workbook . SaveAs ( outputStream ) ; 
43+                 workbook . SaveAs ( Path . GetFullPath ( "Output/ExpandOrCollapse.xlsx" ) ) ; 
4644                #endregion
47- 
48-                 //Dispose streams 
49-                 outputStream . Dispose ( ) ; 
50-                 inputStream . Dispose ( ) ; 
5145            } 
5246        } 
5347    } 
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ static void Main(string[] args)
1111            { 
1212                IApplication  application  =  excelEngine . Excel ; 
1313                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
14-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
15-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
14+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1615                IWorksheet  worksheet  =  workbook . Worksheets [ 1 ] ; 
1716
1817                IPivotTable  pivotTable  =  worksheet . PivotTables [ 0 ] ; 
@@ -22,13 +21,8 @@ static void Main(string[] args)
2221
2322                #region Save
2423                //Saving the workbook 
25-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/PivotCellFormat.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
26-                 workbook . SaveAs ( outputStream ) ; 
24+                 workbook . SaveAs ( Path . GetFullPath ( "Output/PivotCellFormat.xlsx" ) ) ; 
2725                #endregion
28- 
29-                 //Dispose streams 
30-                 outputStream . Dispose ( ) ; 
31-                 inputStream . Dispose ( ) ; 
3226            } 
3327        } 
3428    } 
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ static void Main(string[] args)
1111            { 
1212                IApplication  application  =  excelEngine . Excel ; 
1313                application . DefaultVersion  =  ExcelVersion . Xlsx ; 
14-                 FileStream  inputStream  =  new  FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
15-                 IWorkbook  workbook  =  application . Workbooks . Open ( inputStream ) ; 
14+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ; 
1615                IWorksheet  worksheet  =  workbook . Worksheets [ 1 ] ; 
1716                IPivotTable  pivotTable  =  worksheet . PivotTables [ 0 ] ; 
1817
@@ -21,13 +20,8 @@ static void Main(string[] args)
2120
2221                #region Save
2322                //Saving the workbook 
24-                 FileStream  outputStream  =  new  FileStream ( Path . GetFullPath ( "Output/FormatPivotTable.xlsx" ) ,  FileMode . Create ,  FileAccess . Write ) ; 
25-                 workbook . SaveAs ( outputStream ) ; 
23+                 workbook . SaveAs ( Path . GetFullPath ( "Output/FormatPivotTable.xlsx" ) ) ; 
2624                #endregion
27- 
28-                 //Dispose streams 
29-                 outputStream . Dispose ( ) ; 
30-                 inputStream . Dispose ( ) ; 
3125            } 
3226        } 
3327    } 
Original file line number Diff line number Diff line change @@ -10,19 +10,15 @@ public static void Main(String[] args)
1010            using  ( ExcelEngine  excelEngine  =  new  ExcelEngine ( ) ) 
1111            { 
1212                IApplication  application  =  excelEngine . Excel ; 
13-                 FileStream  fileStream  =  new  FileStream ( Path . GetFullPath ( @"Data/PivotTable.xlsx" ) ,  FileMode . Open ,  FileAccess . Read ) ; 
14-                 IWorkbook  workbook  =  application . Workbooks . Open ( fileStream ) ; 
13+                 IWorkbook  workbook  =  application . Workbooks . Open ( Path . GetFullPath ( @"Data/PivotTable.xlsx" ) ) ; 
1514                IWorksheet  worksheet  =  workbook . Worksheets [ 1 ] ; 
1615
1716                IPivotTable  pivotTable  =  worksheet . PivotTables [ 0 ] ; 
1817                //Layout the pivot table. 
1918                pivotTable . Layout ( ) ; 
2019
21-                 string  fileName  =  "PivotTable_Layout.xlsx" ; 
22-                 //Saving the workbook as stream 
23-                 FileStream  stream  =  new  FileStream ( Path . GetFullPath ( @"Output/PivotTable_Layout.xlsx" ) ,  FileMode . Create ,  FileAccess . ReadWrite ) ; 
24-                 workbook . SaveAs ( stream ) ; 
25-                 stream . Dispose ( ) ; 
20+                 //Saving the workbook  
21+                 workbook . SaveAs ( Path . GetFullPath ( @"Output/PivotTable_Layout.xlsx" ) ) ; 
2622            } 
2723        } 
2824    } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments