I have to create rectangle using C#, can anyone help me with this this?
Code for currently rectangle:
- Code: Select all
public static ChartDataLabel Add(this ChartDataLabelCollection dataLabels, int paragraphs)
{
var cd = dataLabels.Add();
cd.LabelValueVisible = true;
cd.TextFrame.Paragraphs.Clear();
for (int i = 0; i < paragraphs; i++)
{
cd.TextFrame.Paragraphs.Append(CreateParagraph());
}
return cd;
}
public static ChartDataLabel Add(this ChartDataLabelCollection dataLabels, string text)
{
var cd = dataLabels.Add(1);
cd.TextFrame.Paragraphs[0].Text = text;
return cd;
}
public static TextParagraph CreateParagraph()
{
var paragraph = new TextParagraph
{
Alignment = TextAlignmentType.Left,
Text = string.Empty
};
paragraph.FirstTextRange.Format.FontHeight = 8;
return paragraph;
}