Hi Babar/Team,
As requested I am providing the Input file and the code used for reformatting text Boxes,Please help us out in the text Overlap issue facing after Processing it through aspose methods using following Code ,Unprocessed.xlsx is the input file and Processed.xlx is the Output File
private static Workbook AddCommentaryTextboxes(Workbook workbook)
{
FindOptions findOptions = new FindOptions();
findOptions.LookAtType = LookAtType.Contains;
findOptions.CaseSensitive = false;
foreach (Worksheet sheet in workbook.Worksheets)
{
Cell cell = sheet.Cells.Find("##Commentary##", null,findOptions);
while (cell != null)
{
string commentaryblock = cell.Value.ToString();
string[] separators = new string[] { “##” };
string[] parts = commentaryblock.Split(separators, StringSplitOptions.None);
int top = cell.Row;
int left = cell.Column;
int height = Convert.ToInt32(parts[2]);
int width = Convert.ToInt32(parts[3]);
string text = parts[4];
int box = sheet.TextBoxes.Add(top, left, height, width);
Style style;
style = cell.GetStyle();
sheet.TextBoxes[box].Font.Color = style.Font.Color; cell.GetStyle();
sheet.TextBoxes[box].Font.Name = style.Font.Name;
sheet.TextBoxes[box].Font.IsBold = style.Font.IsBold;
sheet.TextBoxes[box].Font.IsItalic = style.Font.IsItalic;
sheet.TextBoxes[box].Font.Size = style.Font.Size;
sheet.TextBoxes[box].Placement = PlacementType.FreeFloating;
sheet.TextBoxes[box].IsTextWrapped = true;
sheet.TextBoxes[box].LineFormat.IsVisible = false;
sheet.TextBoxes[box].TextFrame.AutoSize =true;
sheet.TextBoxes[box].Text = text;
sheet.Cells.ClearContents(cell.Row, cell.Column, cell.Row, cell.Column);
cell = sheet.Cells.Find("##Commentary##", cell,findOptions);
}
using (MemoryStream saveStream = new MemoryStream())
{
workbook.Save(saveStream, SaveFormat.Xlsx);
}
return workbook;
}
Hi,
Thanks Amjad/Team For your suggestion though it fixes the Over lap issue with the above Code some of the above tables present in the sheet are elongated .
I found out the root cause of the issue and found out that allow Text to Over Flow Shape Text Box Property is getting Checked so text is out of the text Box.
Can you please let us know ,How to disable OverFlow property from Aspose as we do in excel Manually?
In excel we rightClick on the Text Box ,Click On the Size and Properties and uncheck Allow Text to OverFlow Property
Hi,
Thanks Amjad for your Sugestion ,if the Rowheight exceeds greater than 409 it will thrown an exception.If the row height is between 0 and 409 the textbox resize works fine.
One thing we observed in Old Aspose version Allow text to Overflow option was unchecked by default but in new Aspose it is getting checked by default.Any fix would be done fix the text Over Flow Issue ?
Dharshan:....if the Rowheight exceeds greater than 409 it will thrown an exception.If the row height is between 0 and 409 the textbox resize works fine.
Dharshan:One thing we observed in Old Aspose version Allow text to Overflow option was unchecked by default but in new Aspose it is getting checked by default.Any fix would be done fix the text Over Flow Issue ?
Hi Amjad,
The version was 5.1.2.0 where disabling of Text Overflow was Happening
Hi,
Hi Team,
Is there any Update on the fix or work around?
Hi,
Hi,
Hi Amjad/Team,
After applying above Code also Overflow option is not getting Unchecked by default
Hi,
I am unable download 8.6.3.5 version of Aspose dll,getting file not found error.
Can you please provide the right link to download aspose dll for Framework 3.5 and 4.0
Hi,
Thanks Amjad I am able to download this dll and will test and provide the feedback
If I try to Compile the Solution using the above dll 8.6.3.5 I am getting following error
Error 13 Could not load file or assembly ‘file:///C:\Corp ReportingBuild\Main\lib\Binaries\Aspose.Cells.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) C:\TESTING\Corp ReportingVeracode - Copy\Main\src\BatchService\SGEN BatchService
So kindly provide dll with a Higher Framework version as 3 .5 or 4.0
Hi Amjad/Team,
It works when we save the File to Physical Location.But when we send it through email as an attatchment it is not working as expectes(Text to Overflow is getting checked by default)
Following is the code used for sending as an attatchment
using (Stream stm = new MemoryStream(processedWorkbookStream.ToArray()))
{
byte[] processedWorkbookStream1;
Workbook wBook = new Workbook(stm);
using (MemoryStream saveStream = new MemoryStream())
{
wBook.Save(saveStream, SaveFormat.Xlsx);
processedWorkbookStream1 = saveStream.ToArray();
}
TraceAdd("Attaching Excel Output to ReportMail");
mail.Attachments.Add(new Attachment(new MemoryStream(processedWorkbookStream1), excelFileName, mimetype));
}
Hi,