We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Custom line patterns

Hello, I’m using Aspose.Diagram for .Net and converting a lot of visio documents containing custom line patterns.
Aspose.Diagram does not convert them (and previously I was informed this won’t be fixed) correctly , but it does produce too many objects in svg which hinders further work with it.
Is there a way to strip shape / line of this custom pattern so that resulting svg would be easily read ?
I need to do that in a loop like this
{
for (int i = 0; i < diagram.Pages[0].Shapes.Count; i++)
{
Shape shape = diagram.Pages[0].Shapes[i];
if (shape.Line.LinePattern.Value == 254 || (shape.InheritLine != null && shape.InheritLine.LinePattern.Value == 254 ))
{ shapeToLines(ref shape); /here I extract information like name of the linepattern and shape.ID to find corresponding g element in generated svg file and modify/
/here I need to change shape so it uses simple line/
}
}
Aspose.Diagram.Saving.SVGSaveOptions option = (Aspose.Diagram.Saving.SVGSaveOptions)Aspose.Diagram.Saving.SaveOptions.CreateSaveOptions(SaveFileFormat.Svg);
diagram.Save(SvgSavePath, options);
}

Here is vsd file and resulting svg file and prefered_result.svg is what I would like to receive insteadlinepattern.zip (21.4 KB)

@sukhareva.jj

We have logged an investigation ticket as DIAGRAMNET-53013 in our issue tracking system to further analyze this case. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello,
I noticed that issue status changed to resolved, does it mean I can expect a fix in november release?

@sukhareva.jj
Yes, we will provide an option to set whether to output customlinepattern for saving svg in next version 22.11 which will be released before this weekend.
Thanks.

The issues you have found earlier (filed as DIAGRAMNET-53013) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou

Hello,
I’ve updated Aspose.Diagram to version 22.11 and I don’t get any difference switching value for IsSavingCustomLinePattern. For vsdx files secondary lines in svg are transparent but for vsd files secondary lines are visible.
Could you check these : Test.zip (32.2 KB)

Could it be that copying the diagram page into a new diagram and then saving to svg affect the result?

 var diagram = new Diagram(filepath);
        var pages = diagram.Pages;
        bool error = false;

        MasterCollection masters = diagram.Masters;
        for (int j = 0; j < pages.Count; j++)
        {
            LineStyles.Clear();
            Page page = pages[j];
 	Page2Svg(ref page, resultPathString, masters);
	}





void Page2Svg(ref Page pagecopy, string savePath, MasterCollection masters = null)
        {

        using (Diagram diagram = new Diagram())
        {
            if (masters!=null) for (var i = 0; i < masters.Count; i++) { diagram.Masters.Add(masters[i]);}
            diagram.Pages.Clear();
            diagram.Pages.Add(pagecopy);
            Aspose.Diagram.Saving.SVGSaveOptions option = (Aspose.Diagram.Saving.SVGSaveOptions)Aspose.Diagram.Saving.SaveOptions.CreateSaveOptions(SaveFileFormat.Svg);
            
            option.IsSavingCustomLinePattern = false;
            option.ExportHiddenPage = false;
            //option.CustomImagePath = Properties.Settings.Default.CustomPath;  
           // option.IsSavingImageSeparately = Properties.Settings.Default.SaveImageSeparate && //option.CustomImagePath != string.Empty ;// false;
            //if (!option.CustomImagePath.EndsWith("\\")){ option.CustomImagePath += '\\'; }
           // option.IsExportScaleInMatrix = Properties.Settings.Default.ScaleinMatrix;               
            diagram.Save(savePath, option);

        }            
    }

@sukhareva.jj

Thanks for the feedback. Another ticket as DIAGRAMNET-53037 has been logged in our issue tracking system for further investigation against this feedback provided by you. We will let you know as soon as the analysis is done and ticket is resolved. Please spare us little time.

We are sorry for the inconvenience.

@sukhareva.jj

Can you please provide the result file from your end? We found the custom line will not be saved when the flag IsSavingCustomLinePattern is set to false.

Please check the attached comparison file for version 22.10 and 22.11. output.zip (2.3 KB)

Hello,
it comes out exactly as 22.10 version BUT only if I transfer page to a new diagram and save that new diagram to svg.
If I save original diagram to svg it does work as expected. I assume I need something to do to newly created diagram for it to work as expected ?

@sukhareva.jj

Thanks for the feedback. We are looking into it and investigating the issue further. We will share updates with you soon.

@sukhareva.jj
Please copy page before adding page to new diagram,sample code:
diagram.Pages.Clear();
Page page = new Page();
page.Copy(pagecopy);
int id = diagram.Pages.Add(page);
page.ID = id;
Aspose.Diagram.Saving.SVGSaveOptions option = (Aspose.Diagram.Saving.SVGSaveOptions)Aspose.Diagram.Saving.SaveOptions.CreateSaveOptions(SaveFileFormat.Svg);

Thanks.