c# - Excel Interop, iterating workbook for worksheet and chart -


i have scenario while working microsoft excel interop.

system.collections.ienumerator wsenumerator = excelapp.activeworkbook.worksheets.getenumerator(); while (wsenumerator.movenext()) {     wscurrent = (excel.worksheet)wsenumerator.current;     //worksheet operation follows    } 

i operating on worksheets, can not have chart in this. want achieve operate on sheets , check if worksheet or chart, , act accordingly.

as sheets contain both worksheet, chart , "excel 4.0 macro", type of sheets each entry can hold of type mentioned.

system.collections.ienumerator wsenumerator = workbookin.sheets.getenumerator(); while (wsenumerator.movenext()) {     //identify if chart or worksheet } 

solved checking type of current enumerator

var item = wsenumerator.current;                    if (item excel.chart) {     //do chart operations } else if (item excel.worksheet) {     //do sheetoperations } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -