Add replace by range
This commit is contained in:
parent
fea2a3ae43
commit
59e471c5f7
|
@ -279,19 +279,6 @@ class LOCellRange(object):
|
|||
def auto_format(self, value):
|
||||
self.obj.autoFormat(value)
|
||||
|
||||
def replace(self, options):
|
||||
descriptor = self.obj.Spreadsheet.createReplaceDescriptor()
|
||||
descriptor.setSearchString(options['Search'])
|
||||
descriptor.setReplaceString(options['Replace'])
|
||||
descriptor.SearchCaseSensitive = options.get('CaseSensitive', False)
|
||||
descriptor.SearchWords = options.get('Words', False)
|
||||
if hasattr(descriptor, 'SearchRegularExpression'):
|
||||
descriptor.SearchRegularExpression = options.get('RegularExpression', False)
|
||||
if hasattr(descriptor, 'SearchType') and 'Type' in options:
|
||||
descriptor.SearchType = options['Type']
|
||||
found = self.obj.replaceAll(descriptor)
|
||||
return found
|
||||
|
||||
@property
|
||||
def validation(self):
|
||||
return self.obj.Validation
|
||||
|
|
|
@ -2050,6 +2050,10 @@ class LOCalcSheet(object):
|
|||
def search_descriptor(self):
|
||||
return self.obj.createSearchDescriptor()
|
||||
|
||||
@property
|
||||
def replace_descriptor(self):
|
||||
return self.obj.createReplaceDescriptor()
|
||||
|
||||
def activate(self):
|
||||
self.doc.activate(self.obj)
|
||||
return
|
||||
|
@ -2418,6 +2422,19 @@ class LOCalcRange(object):
|
|||
|
||||
return rangos
|
||||
|
||||
def replace(self, options):
|
||||
descriptor = self.sheet.replace_descriptor
|
||||
descriptor.setSearchString(options['Search'])
|
||||
descriptor.setReplaceString(options['Replace'])
|
||||
descriptor.SearchCaseSensitive = options.get('CaseSensitive', False)
|
||||
descriptor.SearchWords = options.get('Words', False)
|
||||
if hasattr(descriptor, 'SearchRegularExpression'):
|
||||
descriptor.SearchRegularExpression = options.get('RegularExpression', False)
|
||||
if hasattr(descriptor, 'SearchType') and 'Type' in options:
|
||||
descriptor.SearchType = options['Type']
|
||||
count = self.obj.replaceAll(descriptor)
|
||||
return count
|
||||
|
||||
def in_range(self, rango):
|
||||
if isinstance(rango, LOCalcRange):
|
||||
address = rango.range_address
|
||||
|
|
Loading…
Reference in New Issue