If you are adventurous, you can run such code (first back up your XSS file, this code will overwrite it!). The code will automatically arrange the shapes in the designer. You can adjust the constants for a better effect. Their meanings should be obvious.
using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using System.Text; namespace AutoArrangeXss { class Program { static void Main(string[] args) { AutoArrange(yourXssFilePath); } static void AutoArrange(string xssFile) { const int xPad = 80; const int yPad = 20; const int maxY = 1500; XDocument doc = XDocument.Load(xssFile); var ns = doc.Root.Name.Namespace; var shapes = doc.Descendants(ns + "Shape").ToList(); int X = 0; int Y = 0; int columnW = 0; foreach (XElement shape in shapes) { int Height = int.Parse(shape.Attribute("Height").Value); int Width = int.Parse(shape.Attribute("Width").Value); if (Width > columnW) columnW = Width; shape.Attribute("X").Value = X.ToString(); shape.Attribute("Y").Value = Y.ToString(); Y += Height + yPad; if (Y > maxY) { X += columnW + xPad; Y = 0; columnW = 0; } } doc.Save(xssFile); }
source share