private void AddDataColumn(TlmBase tlm, int index, string value, FontProp fontProp, double width) { double initialWidth = fontProp.rGetTextWidthMM(value); string remainingString = value.Trim(); while (initialWidth > width) { string[] tokens = remainingString.Split(' '); string splitValue = tokens.First(); foreach (string token in tokens.Skip(1)) { if (fontProp.rGetTextWidthMM(splitValue + token) < width) { splitValue = splitValue + ' ' + token; } else { break; } } remainingString = remainingString.Replace(splitValue, ""); tlm.Add(index, new RepString(fontProp, splitValue)); tlm.NewLine(index); initialWidth = fontProp.rGetTextWidthMM(remainingString); } tlm.Add(index, new RepString(fontProp, remainingString)); }
//----------------------------------------------------------------------------------------------------x #region Add/NewLine //----------------------------------------------------------------------------------------------------x //----------------------------------------------------------------------------------------------------x /// <summary>Adds a report object to the current cell.</summary> /// <remarks>The current cell is the cell that is within the current row (<see cref="TlmBase.tlmRow_Cur">TlmBase.tlmRow_Cur</see>) and this column.</remarks> /// <param name="repObj">Report object that will be added to the current cell.</param> /// <exception cref="ReportException">No row is available or the current row is not open.</exception> public void Add(RepObj repObj) { tlmBase.Add(iIndex, repObj); }