Free Support Forum - aspose.com

C# Pagination

I’m sure I must be missing something but what I want to do is add a number of shapes, connect them and then have a paginated Visio diagram.

So I have a number of shapes and can fit 7 shapes per page. Currently I’m creating X pages, then adding 7 shapes to each page before moving on to the next page index.

Is there a better way to do this ? Maybe add all the shapes and then auto space on each page ?

Thanks

Steve

@stevebrettyw

We need to investigate the scenario in detail in order to determine whether your requirements are feasible to achieve or not. Would you please share your sample code snippet which you are using at the moment along with a generated diagram. Please also share used source files with us. We will log an investigation ticket and share the ID with you.

Hi - there’s no point adding an example or a code snippet just yet as what I’m trying to do would seem to be very simple except it doesn’t appear to be working.

So I add 40 shapes to a digram with a single page. And then connect them all using a dynamic connector. When I do this is get a single letter sized page (first shape at 10, 4) and then each shape 1.5 inches below. But the page does not resize so the rest of the shapes are off the bottom of the page.

This:

Page page = diagram.Pages.GetPage(0);
            page.PageSheet.PageProps.DrawingSizeType.Value = DrawingSizeTypeValue.FitPageDrawContents;
            page.PageSheet.PageProps.DrawingResizeType.Value = DrawingResizeTypeValue.Automatically;

Doesn’t do anything.

Setting the height of the page does work but the multipler (ceiling(40/7)) * 11 gives me 6 pages of height but there is a section at the top of the page that when the diagram is loaded become part of a page.

So what I want to do is just add 40 shapes and connectors to a page and have the page resize.

@stevebrettyw

We will further investigate the feasibility to increase the page height/width as per the shapes being added and for the purpose, we have logged an investigation ticket as DIAGRAMNET-51924 in our issue management system. We will inform you as soon as it is resolved. Please spare us some time.

We are sorry for the inconvenience.

I’ve made some progress using the following:

Aspose.Diagram.AutoLayout.LayoutOptions flowChartOptions = new Aspose.Diagram.AutoLayout.LayoutOptions();
            flowChartOptions.LayoutStyle = Aspose.Diagram.AutoLayout.LayoutStyle.FlowChart;
            flowChartOptions.SpaceShapes = 1.0f;
            flowChartOptions.EnlargePage = true;

Applying the layout will create what I’m looking for but there is still a huge problem and that seems to be that the document is built from the bottom up. This means that the tail of the document, and the partial page of there is one, is at the top of the document. When printing this looks awful.

@stevebrettyw

Would you please try to set AutoFitPageToDrawingContent to true when saving like this sample code:

    DiagramSaveOptions saveOptions = new DiagramSaveOptions() {
    SaveFormat = SaveFileFormat.VSDX,
    AutoFitPageToDrawingContent = true
    }; 

In case issue still persists, please share your complete sample code snippet with us. We will further proceed to assist you accordingly.