I need to Create an Infopath form 2010(say XXX) whic will fetch data from Microsoft Excel Spreadsheet and populate it into created(same XXX) Infopath form using Infopath code editor developing environment.
How to achieve this??
I achieve this by including Microsoft.Office.Interop.Excel refereence dll in my Infopath code Editor and added below Code,
ApplicationClass xlsApp = new ApplicationClass();
WorkbookClass xlsWrkBook = (WorkbookClass)xlsApp.Workbooks.Open(("XXX.xlsx", 0, false, 5, "", "", true,XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
Worksheet xlsWrkSht = (Worksheet)xlsWrkBook.Worksheets.get_Item(i);
Range ExcelCellReadData1 = (Range)xlsWrkSht.Cells[x, y];
string del1 = ExcelCellReadData1.Text.ToString();
xlsWrkBook.Close(0, 0, 0);
It works for me to fetch data from Excel and Populate it into Infopath Form.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?