final OfficeStylesCollection predefCollection,
final String attributeName)
throws ReportProcessingException
{
final Object attribute = style.getAttribute(OfficeNamespaces.STYLE_NS, attributeName);
final DataStyle derivedStyle;
if (attribute != null)
{
final String styleName = String.valueOf(attribute);
if (!stylesCollection.getAutomaticStyles().containsDataStyle(styleName) && !stylesCollection.getCommonStyles().containsDataStyle(styleName))
{
try
{
final OfficeStyles automaticStyles = predefCollection.getAutomaticStyles();
final DataStyle autoDataStyle = automaticStyles.getDataStyle(styleName);
if (autoDataStyle != null)
{
derivedStyle = (DataStyle) autoDataStyle.clone();
stylesCollection.getAutomaticStyles().addDataStyle(derivedStyle);
}
else
{
final OfficeStyles commonStyles = predefCollection.getCommonStyles();
final DataStyle commonDataStyle = commonStyles.getDataStyle(styleName);
if (commonDataStyle != null)
{
derivedStyle = (DataStyle) commonDataStyle.clone();
stylesCollection.getCommonStyles().addDataStyle(derivedStyle);
}
else
{
LOGGER.warn("Dangling data style: " + styleName);