Last post May 12, 2020 04:17 AM by mhlu
Jan 24, 2012 10:03 PM|Daggerman1|LINK
I am working on .net web application (VS 2008) and i am using the Excel COM object(Office 2007) in C# and want to insert a checkbox dynamically to an Excel sheet and make it checked
i want to mark as checked an existing checkbox in the Excel sheet programatically to specific cell in a sheet. I have a working method defined to write to excel file but i am facing difficulity to make a checkbox checked or add checkbox to the sheet.
Jan 25, 2012 04:32 AM|raja_durai1|LINK
HiActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _ DisplayAsIcon:=False, Left:=65.25, Top:=24, Width:=108, Height:=21). _ Selectuse this Or refer Ithttp://stackoverflow.com/questions/8935492/how-to-add-a-checkbox-control-to-an-excel-cell-programatically-or-check-or-unche
Jan 25, 2012 07:21 AM|Daggerman1|LINK
i appreciate for your answer, i posted this question at stackoverflow too. I have tried to put the code bellow the method i defined to write to EXCEL, but it's giving me errors message saying ("No overload for method 'OLEObjects' takes '0'") at /Microsoft.Office.Interop.Excel.OLEObjects
objs = oSheet.OLEObjects(???);/. what object am i suppose to pass to the OLEObjects() method? , many thanks for reaching for me!
Microsoft.Office.Interop.Excel.Application oXL = new Microsoft.Office.Interop.Excel.Application();oXL.Visible = true;Microsoft.Office.Interop.Excel._Workbook oWB = (Microsoft.Office.Interop.Excel._Workbook)oXL.Workbooks.Add(System.Reflection.Missing.Value);Microsoft.Office.Interop.Excel._Worksheet oSheet = (Microsoft.Office.Interop.Excel._Worksheet)oWB.ActiveSheet;Microsoft.Office.Interop.Excel.OLEObjects objs = oSheet.OLEObjects();Microsoft.Office.Interop.Excel.OLEObject obj = objs.Add("Forms.CheckBox.1", System.Reflection.Missing.Value, System.Reflection.Missing.Value, false, false, System.Reflection.Missing.Value, System.Reflection.Missing.Value, 65.25, 24, 108, 21);obj.Object.Value = true;
anybody has the idea on how to implement these for .net web app or solve the error i mentioned above? Thanks a lot
May 12, 2020 04:17 AM|mhlu|LINK
Hi, how can I change the name Checkbox1 into something that I want?