2017-08-25 4 views
0

私はこのコードをPPTレポートにテーブルを生成するopenxml sdkを使用しています。 この行が表スタイルの理由です。powerpoint generatron用のopenxmlのテーブルスタイルのテキストを変更

tableStyleId.Text = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"; 

スタイルは次のとおりです。

enter image description here

私は、スタイルや色を変更する必要があるが、私はそれのために何かを見つけることができませんでした。助けてください。前の質問へ

private D.Table GenerateTable(int projectID, string reportType) 
    { 
     // Declare and instantiate table 
     D.Table table = new D.Table(); 

     // Specify the required table properties for the table 
     D.TableProperties tableProperties = new D.TableProperties() { FirstRow = true, BandRow = false }; 
     D.TableStyleId tableStyleId = new D.TableStyleId(); 
     tableStyleId.Text = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"; 

     tableProperties.Append(tableStyleId); 
     D.TableGrid tableGrid1 = new D.TableGrid(); 
     System.Data.DataTable dtData = new System.Data.DataTable(); 
     if (reportType == "projcharter") 
     { 
      //tblXBenefit 
      dtData = GetBenefit(projectID); 

      // Declare and instantiate tablegrid and colums 
      //D.TableGrid tableGrid1 = new D.TableGrid(); 
      D.GridColumn gridColumn1 = new D.GridColumn() { Width = 1848000L }; 
      D.GridColumn gridColumn2 = new D.GridColumn() { Width = 648000L }; 
      D.GridColumn gridColumn3 = new D.GridColumn() { Width = 648000L }; 
      D.GridColumn gridColumn4 = new D.GridColumn() { Width = 648000L }; 

      tableGrid1.Append(gridColumn1); 
      tableGrid1.Append(gridColumn2); 
      tableGrid1.Append(gridColumn3); 
      tableGrid1.Append(gridColumn4); 
     } 
     table.Append(tableProperties); 
     table.Append(tableGrid1); 

     // Instantiate the table header row 
     D.TableRow tableHRow = new D.TableRow() { Height = 0L }; 
     for (int column = 0; column < dtData.Columns.Count; column++) 
     { 
      tableHRow.Append(CreateTextCell(dtData.Columns[column].ToString())); 
     } 
     table.Append(tableHRow); 

     // Instantiate the table data row 
     for (int row = 0; row < dtData.Rows.Count; row++) 
     { 
      // Instantiate the table row 
      D.TableRow tableRow = new D.TableRow() { Height = 0L }; 
      for (int column = 0; column < dtData.Columns.Count; column++) 
      { 
       tableRow.Append(CreateTextCell(dtData.Rows[row][column].ToString())); 
      } 
      table.Append(tableRow); 
     } 
     return table; 
    } 

リンク:それを解決 create dynamic table in powerpoint using openXML with c# and ASP.net

unable to generate second table in PPT report using openxml

How to ignore/solve "Repair" message from Powerpoint report generated by OpenXML with ASP.net

答えて

0

。 私がしたことは、必要なデザインを持つ新しいpptを挿入したテーブルを手動で作成し、ppt xmlとして保存しました(このオプションはsave asで表示されます)。

xmlでtablestyleidを開き、その値をコードで使用します。

関連する問題