Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JODF
>
Tutorial
> Insert cell comment
The following example shows you how to insert cell comment.
import java.util.Date; import com.independentsoft.office.odf.Annotation; import com.independentsoft.office.odf.Cell; import com.independentsoft.office.odf.Paragraph; import com.independentsoft.office.odf.Spreadsheet; import com.independentsoft.office.odf.Table; public class Example { public static void main(String[] args) { try { Spreadsheet spreadsheet = new Spreadsheet(); Annotation annotation1 = new Annotation(); annotation1.setCreator("John"); annotation1.setCreationDate(new Date()); Paragraph commentParagraph = new Paragraph(); commentParagraph.add("My comment text."); annotation1.getContent().add(commentParagraph); Cell a1 = new Cell(100); a1.getContent().add(annotation1); Table sheet1 = new Table(); sheet1.set("A1", a1); spreadsheet.getTables().add(sheet1); spreadsheet.save("c:\\test\\output.ods", true); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*