Why is RichText not working on cell text but works on comment text?

I opened the "Rich-text formatting" sample program and the output doesn't seem to be correct. Cell (A1) all has the same font and color. However, in cell (A4), the comment rich-text does appear to work. public override string Execute() { WorkbookManager manager = new WorkbookManager(); // Add a workbook. Workbook workbook = manager.Workbooks.Add(); workbook.Version = SaveAsFormat; IWorksheet sheet = workbook.Worksheets[0]; // Set value IRange cell = sheet["A1"]; cell.RichText.Text = "This is a rich-text"; //Formatting first 4 characters IFont greyFont = workbook.CreateFont(); greyFont.Bold = true; greyFont.Italic = true; greyFont.RGBColor = Color.FromArgb(333365); cell.RichText.SetFont(0, 4, greyFont); **//This is not working.** cell = sheet["A4"]; cell.Value = "Rich-text comment"; cell.AddComment(); cell.Comment.RichText.Text = "This is a rich-text comment"; cell.Comment.RichText.SetFont(10, 19, greyFont); string fileName = OutputDir "\\" this.GetType().Name "_" Guid.NewGuid().ToString() GetExtension(SaveAsFormat); // Save the document. workbook.SaveAs(fileName); // Close the document. workbook.Close(); return fileName; }
asked 3/7/2019 4:51:18 PM
add a comment

0 Answers

Your Answer

Not the answer you're looking for? Browse other questions tagged document-expert or ask your own question.