My program is giving me an error on this line Pdftable.AddCell(new Phrase(Cell.Value.ToString(),text)); Its saying Object reference not set to an instance of an object
Hey Bro, I'm having this issue "System.NullReferenceException: 'Object reference not defined for an instance of an object. System.Windows.Forms.DataGridViewCell.Value.get retorned null." in this line "worksheet.Cells[i+2,j+1] = produtoDataGridView.Rows[i].Cells[j].Value.ToString();" Could you help me pls?
The Sound is very low, could not hear you even with my volume so high, you should play it yourself and see if you can hear it, but I was able to follow because the video was clear and you moved the mouse reasonably to follow.
worksheet = workbook.Sheets["Sheet1"]; worksheet = workbook.ActiveSheet; error in these lines Error 1 Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Excel._Worksheet'. An explicit conversion exists (are you missing a cast?) C:\Users\Dhivya\Desktop\FaceRecProOV\MakeRegistered.cs 105 25 MultiFaceRec
I have problem in these lines: XLSaveAsAccessMode error : The type or namespace name 'XLSaveAsAccessMode' does not exist in the namespace 'Microsoft.Office.Interop.Excel' (are you missing an assembly reference?) CAN YOU HELP ME!
my project is problem with the error code is : An unhandled exception of type 'System.InvalidCastException' at here > Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing); can you fix this problem as soon as possible ... thanks for ur tutorial :)
Hello, i have a problem. Where can i find the Microsoft Excel 15.0 Object Library. I'm using C# 2010 Express. My system has error. It says, Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX)) and the other one is Check the error code properly of the exception to determine the HRESULT returned by the COM object. Please help me. Thank you!
+samartino sta maria right click on reference and click to add reference and then it will popup reference manager, her you will select COM tab and select libraries now here you can find Microsoft Excel 15.0 Object library
Csharp Space i already click it but there is no microsoft excel 15.0 object library. I tried the other like microsoft office 15.0 object library but still the error is the same. If i dont have microsoft excel it is posible to download it? I look one by one into my COM but there is no microsoft excel sir. I hope you can help me. Thank you very much.
worksheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString(); in here it says below problem. System.NullReferenceException: 'Object reference not set to an instance of an object.'
hello, Im having a problem int the codes, "Object reference not set to an instance of an object." in "sheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString();"
hello, my codes is now running, I just unchecked the properties of datagridview1 (enable delete, enable editing, enable adding) thats all. Thank You for reply :) have a good day
Sir, I have this error could you lend me a hand for this error "System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index' "
You can find step to step description and Source code here: tutorialslink.com/Articles/How-to-import-excel-data-in-MS-SQL-server-database-in-Aspnet-MVC/1
Thank you so much!!! But I need help with the next: " code : " worksheet = workbook.Sheets["Sheet1"];" present the next error"Additional information: El índice no es válido. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))".
Hey Bro, I'm having this issue "System.NullReferenceException: 'Object reference not defined for an instance of an object. System.Windows.Forms.DataGridViewCell.Value.get retorned null." in this line "worksheet.Cells[i+2,j+1] = produtoDataGridView.Rows[i].Cells[j].Value.ToString();" Could you help me pls?
I made it. Thanks bro.😍👍
My program is giving me an error on this line
Pdftable.AddCell(new Phrase(Cell.Value.ToString(),text));
Its saying Object reference not set to an instance of an object
Thank you very much, it worked!
Thank You So Much....
Nice Tutorial. Thanks a lot.
Thank you so much , it worked :)
Hey Bro, I'm having this issue "System.NullReferenceException: 'Object reference not defined for an instance of an object.
System.Windows.Forms.DataGridViewCell.Value.get retorned null." in this line "worksheet.Cells[i+2,j+1] = produtoDataGridView.Rows[i].Cells[j].Value.ToString();" Could you help me pls?
Same here . If you have found the solution please let me know
@@radhikagharote1261 anyone found it?
@@shujanaqvi2668 try this for loop:
For(int i = 0; i
@@radhikagharote1261 oh its working thank you
@@radhikagharote1261 it works, thank you
Only the the first column name is visible other columns are not visible
But the rows are visible
thanks for ur video ,
can u explain why you use type.missing more than one time ?
thanks man!
The Sound is very low, could not hear you even with my volume so high, you should play it yourself and see if you can hear it, but I was able to follow because the video was clear and you moved the mouse reasonably to follow.
Sorry for slow volume but now in my new videos volume is clear
It works thank you, bro!!
thank you for this video
Thank you for video, how can I expoert excel from datagridview with formating.
It was greatly explained, thank you, how we use border on it
worksheet = workbook.Sheets["Sheet1"];
worksheet = workbook.ActiveSheet;
error in these lines
Error 1 Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Excel._Worksheet'. An explicit conversion exists (are you missing a cast?) C:\Users\Dhivya\Desktop\FaceRecProOV\MakeRegistered.cs 105 25 MultiFaceRec
worksheet = workbook.Sheets[1];
Hope will help
@@liga_production I am facing the same issue but it not resolve yet.
worksheet = workbook.Sheets[1];
worksheet = workbook.ActiveSheet;
@@Ram7188 hello.
you may have already solved this problem, but here is my code. And it worked. (sry for my English. Check the code in the next post.)
@@Ram7188 if (dataGridView1.Rows.Count > 0)
{
Microsoft.Office.Interop.Excel.Application xcelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook workbook = xcelApp.Workbooks.Add(Type.Missing);
Microsoft.Office.Interop.Excel.Worksheet worksheet = null;
worksheet = workbook.Sheets[1];
worksheet = workbook.ActiveSheet;
worksheet.Name = "CustomerDetail";
for (int i = 1; i < dataGridView1.Columns.Count + 1; i++)
{
worksheet.Cells[1, i] = dataGridView1.Columns[i - 1].HeaderText;
}
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
for (int j = 0; j < dataGridView1.Columns.Count; j++)
{
worksheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString();
}
}
xcelApp.Columns.AutoFit();
var saveFileDialoge = new SaveFileDialog();
saveFileDialoge.FileName = "Вывод";
saveFileDialoge.DefaultExt = ".xlsx";
if (saveFileDialoge.ShowDialog() == DialogResult.OK)
{
workbook.SaveAs(saveFileDialoge.FileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
}
xcelApp.Quit();
}
I have problem in these lines:
XLSaveAsAccessMode
error : The type or namespace name 'XLSaveAsAccessMode' does not exist in the namespace 'Microsoft.Office.Interop.Excel' (are you missing an assembly reference?)
CAN YOU HELP ME!
You need to add this reference(Microsoft.office.interope.Excel )in your project .
my project is problem with the error code is :
An unhandled exception of type 'System.InvalidCastException'
at here > Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
can you fix this problem as soon as possible ... thanks for ur tutorial :)
Thank you so much!! But you have video :"How to import excel to datagridview in c# windows application" ?
How to append the excel sheet data if excel is already existing
Hi iwanted to ask, is this also compatible with WPF gridview in C#
thank you so much ,how i can check if the Sheet is empty or not
you can can count rows when you export excel.
i want to save image to excel sheet using c# . any solution????? plz help ...!!
Hello, i have a problem. Where can i find the Microsoft Excel 15.0 Object Library. I'm using C# 2010 Express. My system has error. It says, Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX)) and the other one is Check the error code properly of the exception to determine the HRESULT returned by the COM object. Please help me. Thank you!
+samartino sta maria right click on reference and click to add reference and then it will popup reference manager, her you will select COM tab and select libraries now here you can find Microsoft Excel 15.0 Object library
Csharp Space i already click it but there is no microsoft excel 15.0 object library. I tried the other like microsoft office 15.0 object library but still the error is the same. If i dont have microsoft excel it is posible to download it? I look one by one into my COM but there is no microsoft excel sir. I hope you can help me. Thank you very much.
Check this link for reference : www.codeproject.com/Questions/587538/Howplustoplusaddplusmicrosoftplusexcelplus-plus
Csharp Space Ok, thank you very much
+samartino sta maria welcome
how to export only checked rows if there is checkbox
worksheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString(); in here it says below problem.
System.NullReferenceException: 'Object reference not set to an instance of an object.'
I think no data is present at this row and cell in dataGridView, So this error may occurred
you can change it to --------> Convert.ToString(worksheet.Cells[i + 2, j + 1] = memberDataGridView.Rows[i].Cells[j].Value);
very great channel... would you minf helpin in exporting to pdf
ok I will upload in next video
hello, Im having a problem int the codes, "Object reference not set to an instance of an object." in "sheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString();"
+Marlon Dumdumaya I think something is missing in your code, try to debug your code with breakpoint
hello, my codes is now running, I just unchecked the properties of datagridview1 (enable delete, enable editing, enable adding) thats all. Thank You for reply :) have a good day
but another question, Can I add a progress bar on it? progress bar will serve as the process of exporting
@@marlondumdumaya3409 thanks you helped me
Welcome
Do I can show a preview instead of direct save dialogue????
You can use the function app.visible = true, which will open the excel file without saving it. No need to do save dialogue part.
Thank you very much!!
+Noppawin SRIKULCHAYANAN welcome
Sir, I have this error could you lend me a hand for this error "System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index'
"
I think your have loop that goes outside datagrid view total column length
@@CsharpSpace Thanks a lot sir i already notice the error :D
and I already solve it thanks a lot to this video.
@@cybelmaloon8397 how do you slove it beo i have the same problem and i can't fix it
if you try to overwrite the name on same folder, it will show rewrite warning twice. :(
ok I will check
Ottimo good
why when i close the app it didnt stop debug??
I think app is still running in background
hola tengo un ERROR en esta linea de codigo HELP
sheet.Cells [i + 2, j + 1] = dataGridView1.Rows [i] .Cells [j] .Value.ToString ();"
LUISA FERNANDA PINEDA DE LA OSSA tengo en mismo problema, pudiste corregirlo
si correo y envio codigo completo
I have the same error, can you send me a correct code?
tanialagosolmos@gmail.com no logro arreglar esta linea, favor ayudame :(
luisa responde por aca para que todos los que tengan ese error puedan solucionarlo
Exception thrown: 'System.ArgumentOutOfRangeException' in mscorlib.dll
thank you so much for this video please i want import information from Excel to my database can you help me please
and thanks again
yes how can I help you?
I have a file Excel filled with information and I would like to import this information to my database reverse what you've done in this video
You can find step to step description and Source code here: tutorialslink.com/Articles/How-to-import-excel-data-in-MS-SQL-server-database-in-Aspnet-MVC/1
thank you so so much, i wish you success (y)
welcome
Thanks
no microsoft.office in my VS
saves only 4 rows?
no this fetch all rows from datagridview
i have the same issue, only 4 rows are shown
@@CsharpSpace why
the code is not correct.
Can you tell me how to save the file directly to desktop through code?
You can set path of your desktop location to output file
sound lvl is not very loud
Funny, I was thinking it was too quiet, especially because I had to turn the volume up after the ad that showed beforehand.
D1D2 i ment not very loud
what is wrong
System. Argument Out of range Exception
?!
Thank you so much!!! But I need help with the next: " code : " worksheet = workbook.Sheets["Sheet1"];" present the next error"Additional information: El índice no es válido. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))".
you fixsed this bag?
Use index instead:
workSheet = workBook.Sheets[1];
Lo resolviste?
Hey Bro, I'm having this issue "System.NullReferenceException: 'Object reference not defined for an instance of an object.
System.Windows.Forms.DataGridViewCell.Value.get retorned null." in this line "worksheet.Cells[i+2,j+1] = produtoDataGridView.Rows[i].Cells[j].Value.ToString();" Could you help me pls?
i found the error thanks
try to debug the code and find the value for i variable, I think it going outside range.
@@shehzadbhatti1361 how u solved, tell me?
@@نجودخالد-ك1ذ try this for second for loop -> for (int i = 0; i < dataGridView1.Rows.Count-1; i++)