Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Excel functions using Infragistics.Excel
posted

Hi

I do see some samples that says we can use Infragistics.Excel to work with MS Excel objects.

My requirement is that after exporting the Grid to Excel (excel1.xls), I want to read excel2.xls and paste few content on excel1.xls.  Below is the code that I used with MS Excel Object Lib 11.0  But for some reason, I get automation error on the server (it runs just fine on my development machine).  So, thought of using Infragistics.Excel for this simple purpose.  Would you please help to get Infragistics.Excel equivalent?

oBOMDataWB = oXL.Workbooks.Open(strDataXLPath) 'grid exported data

oXLTemplateWB = oXL.Workbooks.Open(strTemplatePath) 'Template that has logo image and format.

oXLTemplateWB.Sheets(1).Range("A1", "AZ9").EntireRow.Copy() 'reading cell by cell will not get correct format, so use EntireRow.Copy()

oBOMDataWB.Sheets(1).Paste()

'Hide the header data rows

oRange = oBOMDataWB.Sheets(1).Range("A10", "A24")

oRange.EntireRow.Hidden = True

oBOMDataWB.Save()

oBOMDataWB.Close()