|
|
|
@@ -2107,6 +2107,16 @@ namespace Novacode |
|
|
|
this.mainPart = table.mainPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The property name to set when specifiying an exact height
|
|
|
|
/// </summary>
|
|
|
|
/// <created>Nick Kusters</created>
|
|
|
|
const string _hRule_Exact = "exact";
|
|
|
|
/// <summary>
|
|
|
|
/// The property name to set when specifying a minimum height
|
|
|
|
/// </summary>
|
|
|
|
/// <created>Nick Kusters</created>
|
|
|
|
const string _hRule_AtLeast = "atLeast";
|
|
|
|
/// <summary>
|
|
|
|
/// Height in pixels. // Added by Joel, refactored by Cathal.
|
|
|
|
/// </summary>
|
|
|
|
@@ -2152,39 +2162,71 @@ namespace Novacode |
|
|
|
// 15 "word units" in one pixel
|
|
|
|
return (heightInWordUnits / 15);
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Get the trPr (table row properties) element for this Row,
|
|
|
|
* null will be return if no such element exists.
|
|
|
|
*/
|
|
|
|
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
|
|
|
|
if (trPr == null)
|
|
|
|
{
|
|
|
|
Xml.SetElementValue(XName.Get("trPr", DocX.w.NamespaceName), string.Empty);
|
|
|
|
trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
|
|
|
|
}
|
|
|
|
SetHeight(value, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// Helper method to set either the exact height or the min-height
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="height">The height value to set (in pixels)</param>
|
|
|
|
/// <param name="exact">
|
|
|
|
/// If true, the height will be forced.
|
|
|
|
/// If false, it will be treated as a minimum height, auto growing past it if need be.
|
|
|
|
/// </param>
|
|
|
|
/// <created>Nick Kusters</created>
|
|
|
|
void SetHeight(double height, bool exact)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Get the trPr (table row properties) element for this Row,
|
|
|
|
* null will be return if no such element exists.
|
|
|
|
*/
|
|
|
|
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
|
|
|
|
if (trPr == null)
|
|
|
|
{
|
|
|
|
Xml.SetElementValue(XName.Get("trPr", DocX.w.NamespaceName), string.Empty);
|
|
|
|
trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the trHeight element for this Row,
|
|
|
|
* null will be return if no such element exists.
|
|
|
|
*/
|
|
|
|
XElement trHeight = trPr.Element(XName.Get("trHeight", DocX.w.NamespaceName));
|
|
|
|
if (trHeight == null)
|
|
|
|
{
|
|
|
|
trPr.SetElementValue(XName.Get("trHeight", DocX.w.NamespaceName), string.Empty);
|
|
|
|
trHeight = trPr.Element(XName.Get("trHeight", DocX.w.NamespaceName));
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Get the trHeight element for this Row,
|
|
|
|
* null will be return if no such element exists.
|
|
|
|
*/
|
|
|
|
XElement trHeight = trPr.Element(XName.Get("trHeight", DocX.w.NamespaceName));
|
|
|
|
if (trHeight == null)
|
|
|
|
{
|
|
|
|
trPr.SetElementValue(XName.Get("trHeight", DocX.w.NamespaceName), string.Empty);
|
|
|
|
trHeight = trPr.Element(XName.Get("trHeight", DocX.w.NamespaceName));
|
|
|
|
}
|
|
|
|
|
|
|
|
// The hRule attribute needs to be set to exact.
|
|
|
|
trHeight.SetAttributeValue(XName.Get("hRule", DocX.w.NamespaceName), "exact");
|
|
|
|
// The hRule attribute needs to be set to exact.
|
|
|
|
trHeight.SetAttributeValue(XName.Get("hRule", DocX.w.NamespaceName), exact ? _hRule_Exact : _hRule_AtLeast);
|
|
|
|
|
|
|
|
// 15 "word units" is equal to one pixel.
|
|
|
|
trHeight.SetAttributeValue(XName.Get("val", DocX.w.NamespaceName), (value * 15).ToString());
|
|
|
|
// 15 "word units" is equal to one pixel.
|
|
|
|
trHeight.SetAttributeValue(XName.Get("val", DocX.w.NamespaceName), (height * 15).ToString());
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// Min-Height in pixels. // Added by Nick Kusters.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Value will be treated as a minimum height, auto growing past it if need be.
|
|
|
|
/// </remarks>
|
|
|
|
/// <created>Nick Kusters</created>
|
|
|
|
public double MinHeight
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
// Just return the value from the normal height property since it doesn't care if you've set an exact or minimum height.
|
|
|
|
return Height;
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
SetHeight(value, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set to true to make this row the table header row that will be repeated on each page
|
|
|
|
/// </summary>
|