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.
Unfortunately, activation email could not send to your email. Please try again.

How do I format TextBox objects?

Thread ID:

Created:

Updated:

Platform:

Replies:

98228 Feb 15,2011 04:11 PM Feb 16,2011 08:21 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Mark Oudesluys
Asked On February 15, 2011 04:11 PM

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


Sridhar [Syncfusion]
Replied On February 16, 2011 08:21 AM

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




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;