[]
IRichText object.An ITextRun object stores the text and character-level formatting for a contiguous portion of rich text in a cell. You can obtain this interface from IRichText.add(String) or from a character range returned by IRange.characters(int,int).
IRichText richText = worksheet.getRange("A1").getRichText();
ITextRun textRun = richText.add("Document");
textRun.getFont().setBold(true);
textRun.setText("Document Solutions");
voiddelete()getFont()getText()insertAfter(String text) ITextRun after the current text run.insertBefore(String text) ITextRun before the current text run.voidUse the returned IFont object to access or modify the font formatting applied to the current text run.
IRichText richText = worksheet.getRange("A1").getRichText();
ITextRun run = richText.add("Document");
IFont font = run.getFont();
font.setBold(true);
Use this method to retrieve the character sequence represented by this run in its parent IRichText object.
IRichText richText = worksheet.getRange("A1").getRichText();
ITextRun run = richText.add("Document Solutions");
String text = run.getText();
Use this method to replace the character sequence represented by this run in its parent IRichText object.
IRichText richText = worksheet.getRange("A1").getRichText();
ITextRun run = richText.add("Document Solutions");
run.setText("Sample");
text - The text of the current text run.ITextRun from its parent IRichText object.Use this method to remove the current text run from the rich text content of a cell.
IRichText richText = worksheet.getRange("A1").getRichText();
richText.add("Hello");
ITextRun textRun = worksheet.getRange("A1").characters(1, 3);
textRun.delete();
ITextRun before the current text run.Use this method to add a new text run immediately before the current run within the parent IRichText object.
IRichText richText = worksheet.getRange("A1").getRichText();
richText.add("Hello");
ITextRun textRun = worksheet.getRange("A1").characters(1, 3);
ITextRun insertedRun = textRun.insertBefore("World");
insertedRun.getFont().setBold(true);
text - The text of the newly inserted text run.ITextRun.ITextRun after the current text run.Use this method to add a new text run immediately after the current run within the parent IRichText object.
IRichText richText = worksheet.getRange("A1").getRichText();
richText.add("Hello");
ITextRun textRun = worksheet.getRange("A1").characters(1, 3);
ITextRun insertedRun = textRun.insertAfter("World");
insertedRun.getFont().setBold(true);
text - The text of the newly inserted text run.ITextRun, or null if the current text run is no longer available in the parent rich text object.