Advertisement
vitareinforce

loop error?

Mar 5th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.98 KB | None | 0 0
  1.                         foreach (Word.Row row in docTable.Rows)
  2.                         {
  3.                             foreach (Word.Cell cell in row.Cells)
  4.                             {
  5.                                 if (row.Index == 1)
  6.                                 {
  7.                                     cell.Range.Text = table.Columns[cell.ColumnIndex - 1].Header.ToString();
  8.                                     cell.Range.Font.Size = 10;
  9.                                     cell.Range.Font.AllCaps = 1;
  10.                                     cell.Range.Font.Bold = 1;
  11.                                 }
  12.                                 else
  13.                                 {
  14.                                     cell.Range.Text = sc.Convert(((DataRowView)table.Items[cell.RowIndex - 2]).Row.ItemArray[cell.ColumnIndex - 1].ToString());
  15.                                     cell.Range.Font.Size = 10;
  16.                                 }
  17.                                 /*
  18.                                  * Loopingnya bocor
  19.                                 switch (cell.ColumnIndex - 1)
  20.                                 {
  21.                                     case 0:
  22.                                         cell.Width = 20;
  23.                                         break;
  24.                                     case 1:
  25.                                         cell.Width = 200;
  26.                                         break;
  27.                                     case 2:
  28.                                         cell.Width = 30;
  29.                                         break;
  30.                                     case 3:
  31.                                         cell.Width = 30;
  32.                                         break;
  33.                                     case 4:
  34.                                         cell.Width = 30;
  35.                                         break;
  36.                                     case 5:
  37.                                         cell.Width = 30;
  38.                                         break;
  39.                                     case 6:
  40.                                         cell.Width = 30;
  41.                                         break;
  42.                                     default:
  43.                                         break;
  44.                                 }
  45.                                  */
  46.                                 /* Loopingnya Bocor Juga
  47.                                 if (cell.ColumnIndex == 1)
  48.                                 {
  49.                                     cell.Width = 20;
  50.                                 }
  51.                                 else if (cell.ColumnIndex == 2)
  52.                                 {
  53.                                     cell.Width = 100;
  54.                                 }
  55.                                 else
  56.                                 {
  57.                                     cell.Width = 50;
  58.                                 }
  59.                                  */
  60.                             }
  61.                         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement