Excellent tutorial. Thank you. I know you hardcoded the column names for the sake of simplicity, but here is a more general version of your code that should work for almost any ListView: private void ExportToExcel(ListView lv) { using (SaveFileDialog sfd = new SaveFileDialog() { Filter = "Excel Workbook|*.xlsx", ValidateNames = true }) { if (sfd.ShowDialog() == DialogResult.OK) { Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application(); Workbook wb = app.Workbooks.Add(XlSheetType.xlWorksheet); Worksheet ws = (Worksheet)app.ActiveSheet; app.Visible = false; for (int j = 1; j
@andresgarcia147
2 жыл бұрын
you saved my life 4 year after this comment
@christopherburgdorff
2 жыл бұрын
@@andresgarcia147 Ha Glad I could help!
@yonchando2640
8 жыл бұрын
Can you make a video and show how to IMPORT from an excel file to database using this IDE? Excelent video.! :)
@foxlearn
8 жыл бұрын
Yes, I'll make soon. Thank you for your suggestion :)
@edwardkauna7397
6 жыл бұрын
At the Entity Data Model Wizard, Connection Properties, i have no server name. The connect to a database area is not lightened. How do i pass this area?
@taylorwhitefall5408
4 жыл бұрын
How can I export this Listview with borders like this (--------------) to excel?
@fryannmartinez1700
6 жыл бұрын
hey men nice video but i have a problem i have this System.Runtime.InteropServices.COMException: 'Exception from HRESULT: 0x800A03EC' im try many times but i dont know how to solve, u can like send me that code to see if im doing something wrong?
@randalashqar6608
2 жыл бұрын
Hello i tried this code but for me it doesnt work i dont know if i do something wrong. if you can you help me i will appreciate it :)
@NHGeneral
2 жыл бұрын
please help me to write data from listview to excel with receipt template
@Galvadion
6 жыл бұрын
Hi, i tried using this in Visual Studio 2013 and i am getting the following error on this line: Worksheet ws = (Woorsheet) app.ActiveSheet; "One or more types required to compile a dynamic expression cannot be found are you missing a reference". Do you got any idea of what this might be?
@maryf465
3 жыл бұрын
5:42 you need to add a reference
@user-xu9rz7he2i
3 жыл бұрын
Thanks you very much!
@burakaydin5420
7 жыл бұрын
when i try different computer i get a error eror is ; Exception from HRESULT: 0x800AC472 and i check to configration manager there is no problem how can i solve this problem?
@lyozov974
7 жыл бұрын
It is because it depends on having the Microsoft Office on the machine.Heard of NPOI gonna try it.
@bilalbaig1017
5 жыл бұрын
Hello! By using the same method above I'm getting this error while exporting to excel.Would you please help me An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll Additional information: Exception from HRESULT: 0x800AC472
@foxlearn
5 жыл бұрын
You should install ms office, then check your code again. i think you miss something
@bilalbaig1017
5 жыл бұрын
@@foxlearn I have already installed ms office i just use exception handling and used sleep function.So when error arises it will catch the exception and start from where it is last left the data.And now it is working fine.Thanks for the tutorial
@foxlearn
5 жыл бұрын
That's great !
@nandafirizki1953
4 жыл бұрын
dang, thank a lot !!!
@thanhloivo730
3 жыл бұрын
good !!!!
@foxlearn
3 жыл бұрын
Thanks!!
@DaiNguyen-pu3cc
5 жыл бұрын
i already code same like you but i got this error: "Error 1 'Microsoft.Office.Interop.Excel.Workbook' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'Microsoft.Office.Interop.Excel.Workbook' could be found (are you missing a using directive or an assembly reference?) Would you please help me T.T (my English is bad so im sorry if have something rude)
@alondramartinezcruz5214
6 жыл бұрын
Thanks
@SuperSafeer2010
7 жыл бұрын
need open source for that ,, thx :)
@rizkyagungramadhan53
7 жыл бұрын
Can I add password to my Export Excel file with this code ? Please Show me How. Thanks
@foxlearn
7 жыл бұрын
OK. Thank you for your suggestion. Let's me research and make tutorial on this
Пікірлер: 29