Trying to assign value back to textbox form control in Excel using C#

Hi ,


i am trying to assign a value to a textbox form control in an Excel sheet but i am not able to do so, I have marked the line where i am trying to assign value to the Textbox control but i cant see any value assigned to the textbox even though debugging successfully. I am using Aspose.Cells in my Project reference.

Name of my textbox control is txtTestControl.

Here is my sample code

Aspose.Cells.Workbook xlWorkBooks;
Aspose.Cells.Worksheet xlWorkSheets;

xlWorkBooks = new Aspose.Cells.Workbook(sExternalFormPath);
xlWorkSheets = xlWorkBooks.Worksheets[“External form”];

foreach (Aspose.Cells.Drawing.Shape oShape in xlWorkSheets.Shapes)
{
if (oShape.Name.IndexOf(“txt”) != -1) // loop through all Textboxes
{
if (oShape.MsoDrawingType == Aspose.Cells.Drawing.MsoDrawingType.TextBox)
{
Aspose.Cells.Drawing.TextBox txtBox = (Aspose.Cells.Drawing.TextBox)oShape;
if (txtBox.Name == “txtTestControl”)
{
txtBox.Text = “DummyData”;
}
}
}
}

Thanks in Advance …

Hi,


Thank you for contacting Aspose support.

Your code is fine so the TextBox.Text property should set accordingly. If you are not getting the desired results with some particular spreadsheet then please provide it to us for proper investigate into your presented scenario. However, please first try the case with latest version of Aspose.Cells for .NET 8.4.0 to see if you can still replicate the problem.

hello,


Many thanks for your reply.I am working on dotnet 4.0 but all the dlls are below this version in the latest zip file that is provided for download.

Thanks.


thanks,


The issue got resolved :slight_smile:

Hi,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is now sorted out. Let us know if you encounter any other issue, we will be glad to look into it and help you further.