Normally you don't need that.
Ctrl+A selects all cells.
Ctrl+M removes hard formatting attributes, which is what I want in most cases but I don't know what you are after.
My SpecialCells extension lists all (unique) format ranges with their respective style name plus hard attributes for a selected range or the entire sheet.
Since every item has the same set of attributes, you have to scan the properties for the ones that are not default.
The relevant Python routine is:
Code: Select all
def getUniqueFormatAttributes(self,oCell):
"""workaround for failing queryContentCells(HARDATTR).
Return an array of property names where style's property-values != style-properties.
Adapted to localized SpecialCells"""
oStylePropertyInfo = self.Document.StyleFamilies.getByName("CellStyles").getByName(oCell.CellStyle).getPropertySetInfo()
aProperties = oCell.getPropertySetInfo().getProperties()
prpNames = []
if oCell.getIsMerged():
prpNames.append(self.Merging)
# <Merging> refers to visible top-left cells of a merged range
elif isSubMerged(oCell):
prpNames.append(self.Merged)
## <Merged> refers to hidden submerged cells
for prp in aProperties:
sName = prp.Name
iState = oCell.getPropertyState(sName)
if (iState == DIRECT_VALUE):
if oStylePropertyInfo.hasPropertyByName(sName):
prpNames.append(sName)
if sName == 'Validation':
prpNames.append(self.Validation)
elif sName == 'ConditionalFormat':
prpNames.append(self.Conditional)
prpNames.sort()
return tuple(prpNames)
It shows <Merged>, <Merging>, <Conditional formatting> and "<Validation>" together with the "normal" cell format attribute names for properties where the property state is DIRECT_VALUE (hard formatting). The program lists only the names of these properties without additional info about the concrete values.