C# misplaced values ​in created word table / datagridview export

first image - input from datagridview

second image - export in MS Word tableimgur.com/nu1EN.jpg

Hello guys,

I need your help, im trying to export datagridview table to MS Word table using Microsoft.Office.Interop..... But i got problem with misplacing data in Word table, can someone help me please. I attached 2 images with input and output and part of my code...Thank you

            Table thirdTable = document.Tables.Add(para3.Range, dataGridViewObjednavka.RowCount, dataGridViewObjednavka.ColumnCount, ref missing, ref missing);
            {
              for (int i=0; i<dataGridViewObjednavka.Rows.Count;i++)
                {
                    for (int j=0; j<dataGridViewObjednavka.Columns.Count; j++)
                    {
                        thirdTable.Cell(i, j).Range.Text = Convert.ToString(dataGridViewObjednavka.Rows[i].Cells[j].Value);
                    }
                }
            }


Read more here: https://stackoverflow.com/questions/68484803/c-sharp-misplaced-values-in-created-word-table-datagridview-export

Content Attribution

This content was originally published by Matis_RnK at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: