Font { @Override public boolean equals(Object o) { if (o instanceof Font) { Font f = (Font) o; if (!this.getFamilyName().equals(f.getFamilyName())) return false; if (!(Math.abs(this.getSize() - f.getSize()) < 0.005)) return false; if (!(this.getFontStyle() == f.getFontStyle())) return false; if ((this.getColor() != null && f.getColor() == null) || (this.getColor() == null && f.getColor() != null)) return false; if ((this.getColor() != null && f.getColor() != null) && (!this.getColor().toString().equals(f.getColor().toString()))) return false; return true; } return false; } Font(String fontFamilyName, StyleTypeDefinitions.FontStyle simpleFontStyle, double fontSize);  Font(String fontFamilyName, StyleTypeDefinitions.FontStyle simpleFontStyle, double fontSize, StyleTypeDefinitions.TextLinePosition textLinePosition);  Font(String fontFamilyName, StyleTypeDefinitions.FontStyle simpleFontStyle, double fontSize, Color color);  Font(String fontFamilyName, StyleTypeDefinitions.FontStyle simpleFontStyle, double fontSize, Color color, StyleTypeDefinitions.TextLinePosition textLinePosition);  Font(String fontFamilyName, StyleTypeDefinitions.FontStyle simpleFontStyle, double fontSize, Locale language);  Font(String fontFamilyName, StyleTypeDefinitions.FontStyle simpleFontStyle, double fontSize, Color color, Locale language);  Font(String fontFamilyName, StyleTypeDefinitions.FontStyle simpleFontStyle, double fontSize, Color color, StyleTypeDefinitions.TextLinePosition textLinePosition,
			Locale language); String getFamilyName(); void setFamilyName(String familyName); StyleTypeDefinitions.FontStyle getFontStyle(); void setFontStyle(StyleTypeDefinitions.FontStyle simpleFontStyle); StyleTypeDefinitions.TextLinePosition getTextLinePosition(); void setTextLinePosition(StyleTypeDefinitions.TextLinePosition textLinePosition); double getSize(); void setSize(double size); Color getColor(); void setColor(Color color); @Override String toString(); @Override boolean equals(Object o);  }
@Test public void testEquals() { try { SpreadsheetDocument document = SpreadsheetDocument.newSpreadsheetDocument(); Table table = document.getTableByName("Sheet1"); Font font = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 17.5, Color.GREEN, StyleTypeDefinitions.TextLinePosition.REGULAR, Locale.ENGLISH); Cell cell = table.getCellByPosition("A1"); cell.setFont(font); cell.setStringValue("Hi World."); document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods")); SpreadsheetDocument doc = SpreadsheetDocument.loadDocument(ResourceUtilities .getTestResourceAsStream("testFontOutput1.ods")); Table table1 = doc.getTableByName("Sheet1"); Cell cell1 = table1.getCellByPosition("A1"); Font font1 = cell1.getFont(); Assert.assertTrue(font.equals(font1)); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } }