Urgent - Re-Layout Code Not Working

Hi,

I’m working on an urgent project which involves taking hierarchical data and turning it into a Visio org chart.

I know that Aspose Diagram does not support this directly so I have written my own code to get this.

The portion of this which appears to be broken is the ability to re-layout the code. Although I call this code it doesn’t seem to apply the re-layout. So here is the code so you can test directly.

protected void Button1_Click(object sender, EventArgs e)
{
    License diagramLicense = new License();
    diagramLicense.SetLicense("Aspose.Total.lic");
    // Load masters from any existing diagram, stencil or template
    // And add in the new diagram
    const string visioStencil = "D:\\Drawing1.vss";
    const string rectangleMaster = @"Rectangle";
    const string connectorMaster = "Dynamic connector";
    const int pageNumber = 0;
    const double width = 1;
    const double height = 1;
    double pinX = 4.25;
    double pinY = 9.5;
    // Define values to construct the hierarchy
    List listPos = new List(new string[] { "0", "0:0", "0:1", "0:2", "0:3", "0:4", "0:5", "0:6", "0:0:0", "0:0:1", "0:3:0", "0:3:1", "0:3:2", "0:6:0", "0:6:1" });
    // define a list to hold the split values
    List list = new List();
    // Create a new diagram
    Diagram diagram = new Diagram(visioStencil);
    foreach (string orgnode in listPos)
    {
        // Add a new rectangle shape
        long rectangleId = diagram.AddShape(
        pinX++, pinY++, width, height, rectangleMaster, pageNumber);
        // Set the new shape's properties
        Shape shape = diagram.Pages[pageNumber].Shapes.GetShape(rectangleId);
        shape.Text.Value.Add(new Txt(orgnode));
        shape.Name = orgnode;
        list.Add(shape.Name.Split(':'));
    }

    // Create connections between nodes
    int shapeId = 2;
    foreach (string[] strArr in list)
    {
        // convert the string array into int array
        int[] myInts = Array.ConvertAll(strArr, int.Parse);
        if (myInts.Length > 1)
        {
            var parent = myInts[myInts.Length - 2];
            parent = parent + myInts.Length - 1;
            Shape connector1 = new Shape();
            long connecter1Id = diagram.AddShape(connector1, connectorMaster, 0);
            diagram.Pages[0].ConnectShapesViaConnector(parent, ConnectionPointPlace.Bottom,
            shapeId, ConnectionPointPlace.Top, connecter1Id);
            shapeId++;
        }
    }

    LayoutOptions compactTreeOptions = new LayoutOptions
    {
        LayoutStyle = LayoutStyle.FlowChart,
        Direction = LayoutDirection.TopToBottom
    };

    //compactTreeOptions.EnlargePage = true;
    diagram.Layout(compactTreeOptions);
    // Save the diagram
    diagram.Save("D:\\OrgChart.vdx", SaveFileFormat.VDX);
}

I’ve attached the two images. The first show what I see in the Visio diagram. The second shows what needs to be clicked inside Visio in order to get the results I would expected.

I would appreciate a speedy resolution as this is on the critical path of a project I’m working on.

Thanks,

Andy.

Hi Andy,

Thank you for contacting support. We managed to replicate the problem of not being able to set flowchart layout with top to bottom direction. It has been logged under ticket id DIAGRAMNET-50997 in our bug tracking system. Your post has also been linked this ticket. We'll keep you informed regarding any available updates. We're sorry for the inconvenience caused.

Thanks for the update. You might want to expand the bug to cover all layout styles & directions because none work.


As this is related to a specific project do you have an eta for the fix please?

Hi Andy,


Thank you for the details. We have logged your concern against the ticket id DIAGRAMNET-50997 in our issue tracking system. The priority of this ticket has also been raised to a high level under the normal support. We just identified this problem. Our product team will analyze it soon. Please spare us a little time. It is not possible for us to share an ETA right at this initial stage.

Hello,


2 weeks have now elapsed, can I have an update on how the fix is coming along please?
Hi Andy,

Thank you for the inquiry. The linked ticket id DIAGRAMNET-50997 is pending for the analysis and not resolved yet. We have asked our product team to take a look at your issue shortly. We'll let you know once an update is available from them.

Hi Andy,


Thank you for being patient. We have received a response from our product team. It is a complex issue. They have plans to fix it in the next one or two months.

Hi - I desperately need this fix - when is it going to be released?

Hi Andy,


Thank you for the inquiry. We’re still in-progress to resolve this issue. The priority of this ticket has also been raised to a high level under the normal support. We’ll immediately let you know once it is fixed. Please spare us a little time.

Hello - We’re two months in now and still no fix?


My project is now way behind - very disappointed in the service.

Hi Andy,


Thank you for the inquiry. The ticket ID DIAGRAMNET-50997 has been partially fixed. We have attached the output VDX drawing to this reply for your kind reference. Please download and use the latest version 16.11.0 of Aspose.Diagram for .NET API. Our product team is still working to check other layout styles to fix them (in case they find any problem). We’ll notify you once it is fixed completely. We’re sorry for the inconvenience caused.

Hello,

I have been testing your most recent release and it appears to be still broken.

While it is true using the LayoutStyle.compactTree does re-arrange the shapes it does not do it the same as the inbuilt Visio functionality. In fact its a lot worse.

CompactTree01 attachment shows the output as generated from Aspose Diagram (CompactTree: DownthenRight)
CompactTree02 attachment shows the inbuilt Visio CompactTree: DownthenRight layout.

As you can see its completely different. I purchased this software on the basis that it mimics the true Microsoft versions of the products. In this instance its fails, therefore unless you can rectify this quickly I believe its fair that you should provide a refund as the product does not perform as advertised.

I look forward to your response and early resolution.

Hi Andrew,


Thank you for writing back.

I am afraid, the ticket logged earlier as DIAGRAMNET-50997 has not been resolved yet. I have logged your concerns to the aforementioned ticket for product team’s review. Moreover, please spare us little time so we could discuss this matter with the concerned member of the product team, and get back with more details as well as an ETA for the resolution, if possible.

I appreciate the reply. However please remember during the discussions with the product team that this fault was originally logged in August 2016. I’ve already waited 6 months so my patience is wearing very thin.

Hi there,


We can understand your situation, and we highly appreciate your patience with us. We require some time to get most recent updates from the product team regarding the said scenario. As soon as we have the clear picture, we will post the details here for your kind reference.

Hi Andrew,


This is to update you that we had a discussion with the concerned member of the product team regarding the ticket DIAGRAMNET-50997. Here are a few updates for your reference. First of all, please note that replicating the Visio’s exact behaviour for the layouts is a complex feature on its own. We have been trying to match the results of Aspose.Diagram APIs with Visio application in all aspects but due to the complexity, we are still not able to get the exactly same results with Aspose.Diagram APIs for each layout change. That said, we have now moved this feature to the top of our road map and currently working to provide a fix within the 1st quarter of year 2017.

As you have already waited a long time to get the fix for the aforementioned issue, I can certainly understand if you wish not to wait any more, however, I assure you that we are following the product team to get the problem resolved at earliest possible, and we will keep you posted with updates in this regard.

Thank you again for your patience with us.

Hi Andrew,


Thank you for being patient. In reference to the ticket ID DIAGRAMNET-50997, our product team has fixed the LayoutStyle of CompactTree and FlowChart in the latest version 17.3.1.0 of Aspose.Diagram for .NET API. Please download and try the latest Hotfix version: Aspose.Diagram for .NET 17.3.1.0. However, the ticket is still open. Once all the layout styles are fixed, then we shall mark it as resolved and notify you as well in this forum thread.

Hi,

Thanks for the update. Unfortuntley I dont think its fixed. I’ve attached two pictures, the first is the Visio output when using assembly version 17.1.0.0 and second is when I try with the new hot fix verison (17.3.1.0)

17.1.0.0

17.3.1.0

This is generated using exactly the same code. Here is the code I am using for the layout portion:

LayoutOptions compactTreeOptions = new LayoutOptions
{
    LayoutStyle = LayoutStyle.CompactTree,
    SpaceShapes = (float)0.5,
    Direction = LayoutDirection.RightThenDown,
    EnlargePage = false
};
diagram.Layout(compactTreeOptions);

As you can see I think this is far from resolved?

Hi Andrew,


Thank you for the feedback. We have passed this information to our product team against the ticket ID DIAGRAMNET-50997. We shall let you know once an update is available from our product team.

I think I have the same problem. I’ve tried with latest hotfix, only VDX file looks properly, in PDF and VSDX all connectors wasn’t recalculated. If I move shapes in Visio, (VSDX file), they will be adjusted, but I don’t have this ability in PDF file.

My sample code is:

Diagram diagram = new Diagram(filePath + "Basic Shapes.vss");
Page page = diagram.Pages[0];

// Add a new rectangle shape
long shapeId = diagram.AddShape(4, 12, 2, 1, @"Rectangle", 0);
Shape shape = page.Shapes.GetShape(shapeId);
shape.ID = 1;
shape.Text.Value.Add(new Txt(@"Rectangle text 1."));

shapeId = diagram.AddShape(2, 10, 2, 1, @"Rectangle", 0);
shape = page.Shapes.GetShape(shapeId);
shape.ID = 2;
shape.Text.Value.Add(new Txt(@"Rectangle text 2."));

shapeId = diagram.AddShape(5, 10, 2, 1, @"Rectangle", 0);
shape = page.Shapes.GetShape(shapeId);
shape.ID = 3;
shape.Text.Value.Add(new Txt(@"Rectangle text 3."));

// Initialize connector shape
shape = new Shape();
shape.Line.EndArrow.Value = 4;
shape.Line.LineWeight.Value = 0.01388;

// Add shape
long connecter1Id = diagram.AddShape(shape, "Dynamic connector", page.ID);
page.ConnectShapesViaConnector(1, ConnectionPointPlace.Bottom, 2, ConnectionPointPlace.Top, connecter1Id);

shape = new Shape();
shape.Line.EndArrow.Value = 4;
shape.Line.LineWeight.Value = 0.01388;

connecter1Id = diagram.AddShape(shape, "Dynamic connector", page.ID);
page.ConnectShapesViaConnector(1, ConnectionPointPlace.Bottom, 3, ConnectionPointPlace.Top, connecter1Id);

// Set layout options
LayoutOptions flowChartOptions = new LayoutOptions();
flowChartOptions.LayoutStyle = LayoutStyle.FlowChart;
flowChartOptions.SpaceShapes = 0.5f;
flowChartOptions.EnlargePage = true;
flowChartOptions.Direction = LayoutDirection.TopToBottom;
diagram.Layout(flowChartOptions);

//diagram.save
diagram.Save(string.Format("{0}Workflow{1}.vdx", filePath, WorkflowId), SaveFileFormat.VDX);
diagram.Save(string.Format("{0}Workflow{1}.pdf", filePath, WorkflowId), SaveFileFormat.PDF);

DiagramSaveOptions options = new DiagramSaveOptions(SaveFileFormat.VSDX);
//options.AutoFitPageToDrawingContent = false;
diagram.Save(string.Format("{0}Workflow{1}.vsdx", filePath, WorkflowId), options);