I need to generate char in a circle like ①… . How can i do this using Aspose.words.
I have license of Aspose and need urgently to display char in a circle.
Hi
Thanks for your request. Try to use the following code to insert this symbol.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.PushFont(); //save current font to stack
builder.Font.Name = "Batang"; //set fornt
builder.Write("\x2460"); //insert sybbol. \x2460 is a hex code of symbol.
builder.PopFont(); //extract font from stack
doc.Save(@"197_95061_GauravG\out.doc");
I hope that it will help you.
Best regards.
What you have suggested is absolutely fine but i want to dynamically generate inside char. the symbol “\x2460” generate only 1 inside circle what if i want to show from 1 to 100000 inside a circle dynamically.
Hi
You can use the following codes to insert symbols (from 1 to 15).
builder.PushFont(); //save current font to stack
builder.Font.Name = "Batang"; //set fornt
builder.Write("\x2460");//insert sybbol. \x2460 is a hex code of symbol. 1
builder.Write("\x2461");//insert sybbol 2
builder.Write("\x2462");//insert sybbol 3
builder.Write("\x2463");//insert sybbol 4
builder.Write("\x2464");//insert sybbol 5
builder.Write("\x2465");//insert sybbol 6
builder.Write("\x2466");//insert sybbol 7
builder.Write("\x2467");//insert sybbol 8
builder.Write("\x2468");//insert sybbol 9
builder.Write("\x2469");//insert sybbol 10
builder.Write("\x246A");//insert sybbol 11
builder.Write("\x246B");//insert sybbol 12
builder.Write("\x246C");//insert sybbol 13
builder.Write("\x246D");//insert sybbol 14
builder.Write("\x246E");//insert sybbol 15
builder.PopFont(); //extract font from stack
Or use the following code to generate this symbols using shape.
for (int i = 0; i < 100; i++)
{
Paragraph par = new Paragraph(doc); //create paragraph
par.ParagraphFormat.Alignment = ParagraphAlignment.Center;
Run run = new Run(doc);
run.Text = i.ToString();
par.AppendChild(run);
Shape shape = new Shape(doc, ShapeType.Ellipse); //create shape (ellipse)
shape.Width = 20; // set size
shape.Height = 20;
shape.VerticalAlignment = VerticalAlignment.Center; // set vertical alignment
shape.TextBox.InternalMarginLeft = 0; //set margins
shape.TextBox.InternalMarginRight = 0;
shape.TextBox.InternalMarginTop = 0;
shape.TextBox.InternalMarginBottom = 0;
shape.AppendChild(par); // add paragraph to shape
shape.WrapType = WrapType.Inline; //set wraping of shape.
builder.InsertNode(shape); // insert shape into the document
}
I hope that it will help you. Also if know how to insert from 1 to 100000 inside a circle using MSWord, then provide me this information and attach the doc file.
Best regards.
What ever u have suggested that is fine but i don’t want to use Shape object as it gives overload to the document.
I want to use "\x2460"
… code.
Can i dynamically generate this code ( so that it increment to "\x2461"
…etc)
I need to show values from 1 to 1000 or may be more so i don’t want to hard code it.
Can you please suggest me the right way.
What you have suggested that is fine but i don’t want to use Shape object as it gives over load to the document.
i want to use "\x2460"
code can i dynamically generate this code(means dynamically it increments to "\x2461"
…) .as i have to list out numbers from 1 to 1000 and its not feasible to hard code these values.
Hi
Try to use the following code.
builder.PushFont(); //save current font to stack
builder.Font.Name = "Batang"; //set fornt
for (int i = 9312; i < 9327; i++)
{
builder.Write(Convert.ToChar(i).ToString());
}
builder.PopFont(); //extract font from stack
But, note that MS Word allow to insert values = 1 to 15 only.
Best regards.