More work on Formatter; successful tests.

This commit is contained in:
Daniel Kraus
2015-07-14 23:19:41 +02:00
parent c43b0af1e3
commit b810cc8a74
9 changed files with 117 additions and 49 deletions

View File

@ -111,12 +111,35 @@ namespace zaaReloaded2.Formatter
reference = String.Empty;
}
string unit;
if (LabItem.HasUnit)
{
unit = String.Format(" {0}", LabItem.Unit);
}
else
{
unit = String.Empty;
}
string value;
if (LabItem.IsNumerical)
{
// Format the numerical value; this will convert
// decimal points to commas as needed.
value = String.Format("{0}", LabItem.NumericalValue);
}
else
{
value = LabItem.Value;
}
// Insert the formatted text into the document.
document.Range().InsertAfter(
String.Format(
"{0} {1}{2}",
"{0} {1}{2}{3}",
LabItem.QualifiedName,
LabItem.Value,
value,
unit,
reference
));
HasBeenUsed = true;