Need help with layout

I need to create a dynamic organization chart layout and would like to use Aspose.Words. The text and colorization also needs to be dynamic. I have attached an example of what I need it to look like.

Is this possible in Aspos? If so, what would I use to achieve this?

Thanks,

Hi Charles,

Thanks for your interest in Aspose.Words. I think, you can achieve this by drawing Rectangle and Line Shapes on to the Page and then in the end grouping them into a single unit. Please see the following code and helper methods to draw individual boxes and lines.

Document doc = new Document();
Shape t1 = CreateTextBox(doc, "first", 10, 200, 100, 30);
Shape t2 = CreateTextBox(doc, "second", 120, 200, 100, 30);
Shape t3 = CreateTextBox(doc, "second", 230, 200, 100, 30);
Shape t4 = CreateTextBox(doc, "second", 340, 200, 100, 30);
Shape l1 = CreateLine(doc, new RectangleF(110, 215, 10, 0));
Shape l2 = CreateLine(doc, new RectangleF(220, 215, 10, 0));
Shape l3 = CreateLine(doc, new RectangleF(330, 215, 10, 0));
Shape l4 = CreateLine(doc, new RectangleF(440, 215, 10, 0));
GroupShape diagram = new GroupShape(doc);
diagram.ChildNodes.Add(t1);
diagram.ChildNodes.Add(l1);
diagram.ChildNodes.Add(t2);
diagram.ChildNodes.Add(l2);
diagram.ChildNodes.Add(t3);
diagram.ChildNodes.Add(l3);
diagram.ChildNodes.Add(t4);
diagram.ChildNodes.Add(l4);
diagram.Left = 0;
diagram.Top = 0;
diagram.Width = 500;
diagram.Height = 100;
diagram.CoordSize = new Size((int)500, (int)100); 
doc.FirstSection.Body.FirstParagraph.AppendChild(diagram);
doc.Save(@"C:\Temp\out.docx");
public static Shape CreateLine(Document doc, RectangleF bounds)
{
    Shape line = new Shape(doc, ShapeType.Line);
    line.StrokeColor = Color.Red;
    line.StrokeWeight = 2;
    line.Bounds = new RectangleF(bounds.Left, bounds.Top, bounds.Width, bounds.Height);
    line.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
    line.RelativeVerticalPosition = RelativeVerticalPosition.Page;
    return line;
}
public static Shape CreateTextBox(Document doc, string text,
    double left, double top, double width, double height)
{
    Shape textBox = new Shape(doc, ShapeType.TextBox);
    textBox.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
    textBox.RelativeVerticalPosition = RelativeVerticalPosition.Page;
    textBox.Left = left;
    textBox.Top = top;
    textBox.Height = height;
    textBox.Width = width;
    textBox.WrapType = WrapType.None;
    textBox.FillColor = Color.Green;
    textBox.ZOrder = 2;
    textBox.AppendChild(new Paragraph(doc));
    Paragraph para = textBox.FirstParagraph;
    para.ParagraphFormat.Alignment = ParagraphAlignment.Center;
    Run run = new Run(doc);
    run.Text = text;
    para.AppendChild(run);
    return textBox;
}

I hope, this helps.

Best regards,