Metin Çiz
Visio’de Metin Çiz
Aspose.Diagram for .NET API, geliştiricilerin bir sayfada metin şekli çizmesine olanak tanır. Aşağıdaki kod örneği, Visio çiziminde nasıl metin çizileceğini gösterir.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
//Initiazlie a new PointF[] | |
PointF[] ps = new PointF[] { new PointF(1, 2), new PointF(2, 0), new PointF(3, 2), new PointF(2, 4), new PointF(1, 2) }; | |
//Draw a diamond shape in page | |
long shapeId = diagram.Pages[0].DrawPolyline(2, 2, 4, 4, ps); | |
// get the added shape from page | |
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
// add text to shape | |
shape.Text.Value.Add(new Txt("Hello world!")); | |
//Aspose.Diagram.Char ch = new Aspose.Diagram.Char(); | |
//shape.Chars.Add(ch); | |
//ch.IX = 0; | |
//// set text font | |
//ch.FontName.Value = "Courier New"; | |
//// set text color | |
//ch.Color.Value = "#ff0000"; | |
//// set font size, unit is 72pt | |
//ch.Size.Value = 16 / 72.0; | |
//Aspose.Diagram.Para para = new Para(); | |
//shape.Paras.Add(para); | |
//para.IX = 0; | |
//// set horizon align | |
//para.HorzAlign.Value = HorzAlignValue.LeftAlign; | |
//// set indent | |
//para.IndLeft.Value = 1.2; | |
// Save diagram | |
diagram.Save(dataDir + "AddTextToShape_out.vsdx", SaveFileFormat.VSDX); |
SVG’de Metin Çiz
Aspose.Diagram for .NET API, geliştiricilerin sayfaya bir metin çizip SVG formatında kaydetmelerini sağlar. Aşağıdaki kod örneği, Visio çiziminde bir metnin nasıl çizileceğini ve SVG formatında nasıl kaydedileceğini gösterir.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
//Initiazlie a new PointF[] | |
PointF[] ps = new PointF[] { new PointF(1, 2), new PointF(2, 0), new PointF(3, 2), new PointF(2, 4), new PointF(1, 2) }; | |
//Draw a diamond shape in page | |
long shapeId = diagram.Pages[0].DrawPolyline(2, 2, 4, 4, ps); | |
// get the added shape from page | |
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
// add text to shape | |
shape.Text.Value.Add(new Txt("Hello world!")); | |
//Aspose.Diagram.Char ch = new Aspose.Diagram.Char(); | |
//shape.Chars.Add(ch); | |
//ch.IX = 0; | |
//// set text font | |
//ch.FontName.Value = "Courier New"; | |
//// set text color | |
//ch.Color.Value = "#ff0000"; | |
//// set font size, unit is 72pt | |
//ch.Size.Value = 16 / 72.0; | |
//Aspose.Diagram.Para para = new Para(); | |
//shape.Paras.Add(para); | |
//para.IX = 0; | |
//// set horizon align | |
//para.HorzAlign.Value = HorzAlignValue.LeftAlign; | |
//// set indent | |
//para.IndLeft.Value = 1.2; | |
// Save diagram as SVG images | |
SVGSaveOptions imageSaveOptions = new SVGSaveOptions(); | |
imageSaveOptions.PageIndex = 0; | |
diagram.Save(dataDir + "AddTextToShape_out.svg", imageSaveOptions); |
PDF’de Metin Çiz
Aspose.Diagram for .NET API, geliştiricilerin sayfaya bir metin çizip PDF formatında kaydetmelerini sağlar. Aşağıdaki kod örneği, Visio çiziminde bir metnin nasıl çizileceğini ve PDF formatında nasıl kaydedileceğini gösterir.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
//Initiazlie a new PointF[] | |
PointF[] ps = new PointF[] { new PointF(1, 2), new PointF(2, 0), new PointF(3, 2), new PointF(2, 4), new PointF(1, 2) }; | |
//Draw a diamond shape in page | |
long shapeId = diagram.Pages[0].DrawPolyline(2, 2, 4, 4, ps); | |
// get the added shape from page | |
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
// add text to shape | |
shape.Text.Value.Add(new Txt("Hello world!")); | |
//Aspose.Diagram.Char ch = new Aspose.Diagram.Char(); | |
//shape.Chars.Add(ch); | |
//ch.IX = 0; | |
//// set text font | |
//ch.FontName.Value = "Courier New"; | |
//// set text color | |
//ch.Color.Value = "#ff0000"; | |
//// set font size, unit is 72pt | |
//ch.Size.Value = 16 / 72.0; | |
//Aspose.Diagram.Para para = new Para(); | |
//shape.Paras.Add(para); | |
//para.IX = 0; | |
//// set horizon align | |
//para.HorzAlign.Value = HorzAlignValue.LeftAlign; | |
//// set indent | |
//para.IndLeft.Value = 1.2; | |
// Save diagram | |
diagram.Save(dataDir + "AddTextToShape_out.pdf", new PdfSaveOptions()); |
PNG’de Metin Çiz
Aspose.Diagram for .NET API, geliştiricilerin sayfaya bir metin çizip PNG formatında kaydetmelerini sağlar. Aşağıdaki kod örneği, Visio çiziminde bir metnin nasıl çizileceğini ve PNG formatında nasıl kaydedileceğini gösterir.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
//Initiazlie a new PointF[] | |
PointF[] ps = new PointF[] { new PointF(1, 2), new PointF(2, 0), new PointF(3, 2), new PointF(2, 4), new PointF(1, 2) }; | |
//Draw a diamond shape in page | |
long shapeId = diagram.Pages[0].DrawPolyline(2, 2, 4, 4, ps); | |
// get the added shape from page | |
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
// add text to shape | |
shape.Text.Value.Add(new Txt("Hello world!")); | |
//Aspose.Diagram.Char ch = new Aspose.Diagram.Char(); | |
//shape.Chars.Add(ch); | |
//ch.IX = 0; | |
//// set text font | |
//ch.FontName.Value = "Courier New"; | |
//// set text color | |
//ch.Color.Value = "#ff0000"; | |
//// set font size, unit is 72pt | |
//ch.Size.Value = 16 / 72.0; | |
//Aspose.Diagram.Para para = new Para(); | |
//shape.Paras.Add(para); | |
//para.IX = 0; | |
//// set horizon align | |
//para.HorzAlign.Value = HorzAlignValue.LeftAlign; | |
//// set indent | |
//para.IndLeft.Value = 1.2; | |
// Save diagram as PNG image | |
ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFileFormat.PNG); | |
imageSaveOptions.PageIndex = 0; | |
diagram.Save(dataDir + "AddTextToShape_out.png", imageSaveOptions); |
HTML’de Metin Çiz
Aspose.Diagram for .NET API, geliştiricilerin sayfaya bir metin çizip HTML formatında kaydetmelerini sağlar. Aşağıdaki kod örneği, Visio çiziminde bir metnin nasıl çizileceğini ve HTML formatında nasıl kaydedileceğini gösterir.
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
//Initiazlie a new PointF[] | |
PointF[] ps = new PointF[] { new PointF(1, 2), new PointF(2, 0), new PointF(3, 2), new PointF(2, 4), new PointF(1, 2) }; | |
//Draw a diamond shape in page | |
long shapeId = diagram.Pages[0].DrawPolyline(2, 2, 4, 4, ps); | |
// get the added shape from page | |
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
// add text to shape | |
shape.Text.Value.Add(new Txt("Hello world!")); | |
//Aspose.Diagram.Char ch = new Aspose.Diagram.Char(); | |
//shape.Chars.Add(ch); | |
//ch.IX = 0; | |
//// set text font | |
//ch.FontName.Value = "Courier New"; | |
//// set text color | |
//ch.Color.Value = "#ff0000"; | |
//// set font size, unit is 72pt | |
//ch.Size.Value = 16 / 72.0; | |
//Aspose.Diagram.Para para = new Para(); | |
//shape.Paras.Add(para); | |
//para.IX = 0; | |
//// set horizon align | |
//para.HorzAlign.Value = HorzAlignValue.LeftAlign; | |
//// set indent | |
//para.IndLeft.Value = 1.2; | |
// Save diagram | |
diagram.Save(dataDir + "AddTextToShape_out.html", new HTMLSaveOptions()); |