parameters: (self, value, isDate, format_str)
docstring: This method tries to guess the best format to apply to the current text
          value.
  
          :param `value`: the actual raw cell text value;
          :param `isDate`: ``True`` if this value represents a `xlrd` date object,
           ``False`` otherwise;
          :param `format_str`: the actual formatting string as extracted from Excel.
  
          :note: This method is used only if Mark Hammonds' `pywin32` package is
           not available to try and format the cell text in an intelligent way.
  
          .. warning::
  
             The formatting applied by this method is severely limited; for
             instance, you won't probably get the exact WYSIWYG between the Excel
             spreadsheet and :class:`XLSGrid`.
docstring_summary: This method tries to guess the best format to apply to the current text
          value.
docstring_tokens: This method tries to guess the best format to apply to the current text value .
function: def FormatString(self, value, isDate, format_str):
          """
          This method tries to guess the best format to apply to the current text
          value.
  
          :param `value`: the actual raw cell text value;
          :param `isDate`: ``True`` if this value represents a `xlrd` date object,
           ``False`` otherwise;
          :param `format_str`: the actual formatting string as extracted from Excel.
  
          :note: This method is used only if Mark Hammonds' `pywin32` package is
           not available to try and format the cell text in an intelligent way.
  
          .. warning::
  
             The formatting applied by this method is severely limited; for
             instance, you won't probably get the exact WYSIWYG between the Excel
             spreadsheet and :class:`XLSGrid`.
             
          """
          
          if "General" in format_str:
              self.value = "%s"%value
              return
          
          number_format = format_str
          currency = percentage = ""
  
          if not isDate:
              symbol = ""
              split = format_str.split()
              if len(split) > 1:
                  # Accounting and currency shit
                  currency = split[0].split(".")[0] + "."
                  number_format = ".".join(split[1:])
  
              if "%" in number_format:
                  percentage = "%"
                  value = 100*value
                  number_format = number_format[0:-1]
  
              representation = "%d"
              if "." in number_format:
                  split = number_format.split(".")
                  num_decimals = len(split[1])
                  representation = "%0." + str(num_decimals) + "f"
  
              try:
                  value = representation%value
              except ValueError:
                  # Fall back to string
                  value = unicode(value, "utf-8", "ignore")
              
              if "#," in number_format:
                  value = SplitThousands(value)
                  
              value = currency + value + percentage
  
          else:
              number_format = format_str.replace("\\", "")
              number_format = number_format.replace("-", "-%").replace("/", "/%")
              value = datetime.datetime(*value)
              try:
                  value = value.strftime(number_format)
              except (ValueError, TypeError):
                  value = value.strftime("%d.%m.%Y")
  
          self.value = value
function_tokens: def FormatString ( self , value , isDate , format_str ) : if "General" in format_str : self . value = "%s" % value return number_format = format_str currency = percentage = "" if not isDate : symbol = "" split = format_str . split ( ) if len ( split ) > 1 : # Accounting and currency shit currency = split [ 0 ] . split ( "." ) [ 0 ] + "." number_format = "." . join ( split [ 1 : ] ) if "%" in number_format : percentage = "%" value = 100 * value number_format = number_format [ 0 : - 1 ] representation = "%d" if "." in number_format : split = number_format . split ( "." ) num_decimals = len ( split [ 1 ] ) representation = "%0." + str ( num_decimals ) + "f" try : value = representation % value except ValueError : # Fall back to string value = unicode ( value , "utf-8" , "ignore" ) if "#," in number_format : value = SplitThousands ( value ) value = currency + value + percentage else : number_format = format_str . replace ( "\\" , "" ) number_format = number_format . replace ( "-" , "-%" ) . replace ( "/" , "/%" ) value = datetime . datetime ( * value ) try : value = value . strftime ( number_format ) except ( ValueError , TypeError ) : value = value . strftime ( "%d.%m.%Y" ) self . value = value