We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How do I format TextBox objects?

Hi,

I am using a number of Excel templates to create reports on the fly. I am having an issue with the TextBoxes on a Chart, where the text gets enlarged quite a bit when I copy the template into the workbook I am creating. I have opened an incident with Syncfusion, but they can't recreate the issue and therefore can't fix it.

So I need to write a bit of code to see if I can fix them myself. But I can't seem to find any way of doing this. Can someone help?

I was doing the following to see if there were any properties of the TextBox object which I could modify:
wsPage.Charts[0].TextBoxes["TBTopLeft"]... (here I was hoping to find something like font or style).

Does anyone know how I might be able to do this?

Thanks,
Mark


1 Reply

SR Sridhar Syncfusion Team February 16, 2011 01:21 PM UTC

Hi Mark,

We highly regret for the inconvenience.

We have created the workaround to modify the Text Box’s font style. Please get the workaround and let us know if this helps you

Please follow up the Incident 76970 for more details on this reported issue.

Workaround:

C# Code:

IWorksheet sourceWSheet = sourceWorkbook.Worksheets[0];
IChart chart = sourceWSheet.Charts[0];
ITextBoxes textBoxes = chart.TextBoxes;
int count = chart.TextBoxes.Count;
for (int i = 0; i < count; i++)
{
ITextBox textBox = textboxes[i];
IFont newFont = destWorkbook.CreateFont();
newFont.Size = 11;
textBox.RichText.SetFont(0, 5, newFont);
}


Please let us know if you have any clarifications.

Thanks,
Sridhar.S




Loader.
Live Chat Icon For mobile
Up arrow icon