瀏覽代碼

Added SetWidthsPercentage(float[] widthsPercentage, float? totalWidth) for Tables as per kanadmehta proposition (#42)

master
PrzemyslawKlys 9 年之前
父節點
當前提交
800a1618b7
共有 4 個文件被更改,包括 13 次插入1 次删除
  1. 13
    1
      DocX/Table.cs
  2. 二進制
      DocX/bin/Debug/DocX.dll
  3. 二進制
      DocX/bin/Release/DocX.dll
  4. 二進制
      Documentation/Help/Documentation.chm

+ 13
- 1
DocX/Table.cs 查看文件

@@ -210,6 +210,18 @@ namespace Novacode
}
}
/// <summary>
/// Set Table column width by prescribing percent
/// </summary>
/// <param name="widthsPercentage">column width % list</param>
/// <param name="totalWidth">Total table width. Will be calculated if null sent.</param>
public void SetWidthsPercentage(float[] widthsPercentage, float? totalWidth)
{
if (totalWidth == null) totalWidth = this.Document.PageWidth - this.Document.MarginLeft - this.Document.MarginRight; // calculate total table width
List<float> widths = new List<float>(widthsPercentage.Length); // empty list, will hold actual width
widthsPercentage.ToList().ForEach(pWidth => { widths.Add(pWidth * totalWidth.Value / 100); }); // convert percentage to actual width for all values in array
SetWidths(widths.ToArray()); // set actual column width
}
/// <summary>
@@ -3807,5 +3819,5 @@ namespace Novacode
public bool NoHorizontalBanding { get; set; }
public bool NoVerticalBanding { get; set; }
}
}

二進制
DocX/bin/Debug/DocX.dll 查看文件


二進制
DocX/bin/Release/DocX.dll 查看文件


二進制
Documentation/Help/Documentation.chm 查看文件


Loading…
取消
儲存