Formato Visio Páginas

Aspose.Diagram for Java API permite a los desarrolladores formatear páginas de un archivo Visio Diagram. La aplicación de hojas de estilo es uno de esos métodos para formatear Visio páginas.

Aplicar hojas de estilo a la página Visio

Aspose.Diagram for Java API le permite formatear una página Visio usando hojas de estilo. Puede definir una hoja de estilo y agregarla a la colección de hojas de estilo del documento Visio. El método ApplyStyle de la clase Page le permite aplicar la hoja de estilo definida a la página como se muestra en el siguiente ejemplo de código.

// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(ReadDiagramFile.class) + "Diagrams/";
// Open the stream. Read only access is enough for Aspose.Diagram to
// load a diagram.
InputStream stream = new FileInputStream(dataDir + "ReadDiagramFile.vsd");
// load diagram
Diagram vsdDiagram = new Diagram(stream);
//Define a new StyleSheet
StyleSheet st = new StyleSheet();
st.setID(vsdDiagram.getStyleSheets().getCount()+1);
com.aspose.diagram.Char ch = new com.aspose.diagram.Char();
ch.getColor().setValue("#00ff00");
ch.setIX(0);
st.getChars().add(ch);
st.getLine().getLineColor().setValue("#ff0000");
st.getLine().getLinePattern().setValue(1);
st.getLine().getLineWeight().setValue(0.01);
st.getFill().getFillForegnd().setValue("#0000ff");
st.getFill().getFillPattern().setValue(1);
st.getFill().getShdwPattern().setValue(0);
//Add the stylesheet to Stylesheets collection
vsdDiagram.getStyleSheets().add(st);
for (Shape shape: (Iterable<Shape>)vsdDiagram.getPages().get(0).getShapes())
{
shape.getLine().getLinePattern().setValue(1);
shape.getFill().getFillPattern().setValue(1);
}
//Apply the stylesheet
vsdDiagram.getPages().get(0).applyStyle(st.getID(), st.getID(), st.getID());