Setting preformatted text

I am retrieving text from a sql database and setting it to the cells. Some parts of the text is formatted using word formatting. How can I set this text and show it formatted on cells??

Thanks in advance


This message was posted using Support 2 Forum

Hi,

Thank you for your request. Please clarify what "word formatting" means. Is it an RTF text or something? I would appreciate if you provided some more details of your task, gave code samples ans so on. This would greatly simplify help.

Thanks for you reply:

I am doing the following:

I have a web page where the user can input some text, the user can format font type, color, size etc.

for instance the following text

this is only a comment text

generates:

this is only a comment text

which is what I store on the DB. Then I can use this info to export to a Excel file. programatically I got a function that populate my required fields on the Excel cells:

private void AddFastPlay(Aspose.Cells.Workbook workbook, string title, string productionId)
{
int fastPlayId = workbook.Worksheets.Add( Aspose.Cells.SheetType.Worksheet );
workbook.Worksheets[fastPlayId].Name = "FastPlay";
Worksheet sheet = workbook.Worksheets[ fastPlayId ];
DataRow dsFastPlay = GetFastPlay( productionId ); // retrieves info from DB
sheet.Cells[0,0].PutValue(title + "-Fastplay"); // sets page title
mergeHeading(sheet, 0, 0, 17); // merge title cells
setCellFormatsHeader(sheet.Cells[1, 0]);// formats header
sheet.Cells[1, 0].PutValue("Lock date: ");// set header text
sheet.Cells[1,1].PutValue( dsFastPlay["lockDate"]);// set header text
sheet.Cells[1,1].Style.Custom = "m/d/yyy"; // format date cell
sheet.Cells.StandardWidth = 10;
mergeCell( sheet, 1, 1, 16, Color.FromArgb(211, 211, 211));
sheet.Cells[2,0].PutValue( Tools.UnScape(dsFastPlay["data"].ToString())); // here is where the problem arises, it shows all formatting tags, instead of formatting the text
mergeCell(sheet, 2, 0, 17, Color.White);
}

So the question is, is there anything I can do to show the formatted on my Excel export??

I think Aspose.Words has nothing to do with this task so I have moved the thread to the Aspose.Cell forum. I hope Aspose.Cell developers will help you shortly.

Hi,

Please try to do as the following codes:

Cell cell = sheet.Cells[2,0];
cell.PutValue("this is only a comment text");
Characters chars = cell.Characters(0, 12);
chars.Font.Color = Color.Red;

Hi, just want to thank you for your support, it has been very helpful