I tried creating two textboxes with the same content on top of each other and have the topmost textbox overflow its content. The top textbox has a dark background while the textbox below is transparent, so I would achieve the effect pictured in desired.png.
The following code creates two textbox in the given format on top of each other but the wrapping does not behave like I want it. See picture actual.png. I tried playing around with the TextVerticalOverflow property on the Shape but I can’t manage to get the effect I am looking for.
Is there a way how I manage to get this effect? Maybe there are some properties I haven’t noticed or do you have another idea how to display an overflowing content of a dark textbox (so the font is white) while having a dark font on the overflowing part of the content? The lenght of the textbox is fixed and cannot be extended.
Thank you very much.
/Florian
Code sample:
String demoFile = “Demo.xls”;
String containingText = “abcdefghij klmnopqrstuvwxyz 1234567890”;
if (File.Exists(demoFile))
File.Delete(demoFile);
Workbook book = new Workbook();
Worksheet sheet = book.Worksheets[0];
Aspose.Cells.Drawing.TextBox textboxInBack = sheet.Shapes.AddTextBox(1, 0, 1, 0, 20, 100);
textboxInBack.Text = containingText;
textboxInBack.Font.IsBold = true;
textboxInBack.LineFormat.IsVisible = false; // hide lines
textboxInBack.FillFormat.IsVisible = false; // background transparent
textboxInBack.TextFrame.AutoSize = true;
Aspose.Cells.Drawing.TextBox textboxInFront = sheet.Shapes.AddTextBox(1, 0, 1, 0, 20, 100);
textboxInFront.Text = containingText;
textboxInFront.Font.IsBold = true;
textboxInFront.Font.Color = Color.White;
textboxInFront.FillFormat.ForeColor = Color.Black;
book.Save(demoFile);
Hi,
Kindly create your desired textboxes in MS Excel manually to save the file, post your file here, we will check it soon.
Thank you.
Hi Amjad,
Please see the attached Excel-File for the mentioned effect.
/Florian
Hi,
Thanks for providing us the template file for your desired TextBox effects.
We understand your requirement now. I have logged your issue into our issue tracking system with an id: CELLSNET-22893. Once we have any update, we will let you know about it soon.
Thank you.
Hi,
We have analyzed your feature request. It is the advance feature of Excel 2007-2010.
We will try to support it in XLSX file format first, so may be this will suit your need at the moment. We could not support it in XLS file very soon. We will look into it later.
Thanks for your understanding!
Hi,
Please try the attached version.
We have supported this feature for xlsx file, hopefully it will suit your need at the moment.
Please try the following code:
String demoFile = ExcelTest.destPath + “CellsNet22893.xlsx”;
String containingText = “abcdefghij klmnopqrstuvwxyz 1234567890”;
Workbook book = new Workbook();
Worksheet sheet = book.Worksheets[0];
Aspose.Cells.Drawing.TextBox textboxInBack = sheet.Shapes.AddTextBox(1, 0, 1, 0, 20, 100);
textboxInBack.Text = containingText + “_1”;
textboxInBack.Font.IsBold = true;
textboxInBack.LineFormat.IsVisible = false; // hide lines
textboxInBack.FillFormat.IsVisible = false; // background transparent
textboxInBack.TextFrame.AutoSize = true;
textboxInBack.TextVerticalOverflow = TextOverflowType.Overflow;
textboxInBack.IsTextWrapped = false;
Aspose.Cells.Drawing.TextBox textboxInFront = sheet.Shapes.AddTextBox(1, 0, 1, 0, 20, 100);
textboxInFront.Text = containingText;
textboxInFront.Font.IsBold = true;
textboxInFront.Font.Color = Color.White;
textboxInFront.FillFormat.ForeColor = Color.Black;
textboxInFront.TextHorizontalOverflow = TextOverflowType.Clip;
textboxInFront.TextVerticalOverflow = TextOverflowType.Clip;
textboxInFront.IsTextWrapped = false;
book.Save(demoFile);
Thank you.
Hello Amjad,
Thank you very much for this quick fix. I appreciate your prompt reaction and according to my first tests does the overflowing work as expected. Well done!
Regards,
Florian
The issues you have found earlier (filed as 22893) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.