public static void Save(string file, TableItem[] items) { XmlSerializer ser = new XmlSerializer(typeof(TableItem[])); using (FileStream stream = new FileStream(file, FileMode.Create, FileAccess.Write)) { ser.Serialize(stream, items); } }
private int GetNumberLength(List<Rectangle> rightLine, TableItem item) { int numberLength; for (numberLength = 1; numberLength < rightLine.Count; numberLength++) { if (ImageLetters.IsNewWord(rightLine, numberLength, false)) { break; } } if (item.Percentage && numberLength == rightLine.Count) { // Percentage values use "short" value because the space separating the // component name is sometimes not visible. // TODO: Find a way to remove the '%', this would create enough space. for (numberLength = rightLine.Count - 1; numberLength >= 0; numberLength--) { if (ImageLetters.IsNewWord(rightLine, numberLength, true)) { break; } } } if (item.AllText) { numberLength = 0; } else { numberLength = Math.Max(numberLength - item.ExcludeUnit, 0); } return numberLength; }