Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
ss1.SheetParser Class Reference

List of all members.

Public Member Functions

def __init__
def parsefile
def startelement
def data
def endelement
def start_cell
def start_value
def end_int
def end_long
def end_double
def end_complex
def end_string
def end_value
def end_formula
def end_cell

Public Attributes

 sheet
 texts
 y
 x
 fmt
 alignment
 value
 cell

Static Public Attributes

 start_formula = start_value

Detailed Description

Definition at line 227 of file ss1.py.


Constructor & Destructor Documentation

def ss1.SheetParser.__init__ (   self,
  sheet 
)

Definition at line 229 of file ss1.py.

00229 
00230     def __init__(self, sheet):
00231         self.sheet = sheet

Here is the caller graph for this function:


Member Function Documentation

def ss1.SheetParser.data (   self,
  text 
)

Definition at line 247 of file ss1.py.

00247 
00248     def data(self, text):
00249         text = str(text) # XXX Convert Unicode to 8-bit
00250         self.texts.append(text)

Here is the caller graph for this function:

def ss1.SheetParser.end_cell (   self,
  text 
)

Definition at line 313 of file ss1.py.

00313 
00314     def end_cell(self, text):
00315         self.sheet.setcell(self.x, self.y, self.cell)

def ss1.SheetParser.end_complex (   self,
  text 
)

Definition at line 284 of file ss1.py.

00284 
00285     def end_complex(self, text):
00286         try:
00287             self.value = complex(text)
00288         except:
00289             self.value = None

def ss1.SheetParser.end_double (   self,
  text 
)

Definition at line 278 of file ss1.py.

00278 
00279     def end_double(self, text):
00280         try:
00281             self.value = float(text)
00282         except:
00283             self.value = None

def ss1.SheetParser.end_formula (   self,
  text 
)

Definition at line 308 of file ss1.py.

00308 
00309     def end_formula(self, text):
00310         self.cell = FormulaCell(text,
00311                                 self.fmt or "%s",
00312                                 self.alignment or RIGHT)

def ss1.SheetParser.end_int (   self,
  text 
)

Definition at line 266 of file ss1.py.

00266 
00267     def end_int(self, text):
00268         try:
00269             self.value = int(text)
00270         except:
00271             self.value = None

def ss1.SheetParser.end_long (   self,
  text 
)

Definition at line 272 of file ss1.py.

00272 
00273     def end_long(self, text):
00274         try:
00275             self.value = int(text)
00276         except:
00277             self.value = None

def ss1.SheetParser.end_string (   self,
  text 
)

Definition at line 290 of file ss1.py.

00290 
00291     def end_string(self, text):
00292         try:
00293             self.value = text
00294         except:
00295             self.value = None

def ss1.SheetParser.end_value (   self,
  text 
)

Definition at line 296 of file ss1.py.

00296 
00297     def end_value(self, text):
00298         if isinstance(self.value, BaseCell):
00299             self.cell = self.value
00300         elif isinstance(self.value, str):
00301             self.cell = StringCell(self.value,
00302                                    self.fmt or "%s",
00303                                    self.alignment or LEFT)
00304         else:
00305             self.cell = NumericCell(self.value,
00306                                     self.fmt or "%s",
00307                                     self.alignment or RIGHT)

def ss1.SheetParser.endelement (   self,
  tag 
)

Definition at line 251 of file ss1.py.

00251 
00252     def endelement(self, tag):
00253         method = getattr(self, 'end_'+tag, None)
00254         if method:
00255             method("".join(self.texts))

Here is the call graph for this function:

Here is the caller graph for this function:

def ss1.SheetParser.parsefile (   self,
  f 
)

Definition at line 232 of file ss1.py.

00232 
00233     def parsefile(self, f):
00234         parser = expat.ParserCreate()
00235         parser.StartElementHandler = self.startelement
00236         parser.EndElementHandler = self.endelement
00237         parser.CharacterDataHandler = self.data
00238         parser.ParseFile(f)

Here is the call graph for this function:

def ss1.SheetParser.start_cell (   self,
  attrs 
)

Definition at line 256 of file ss1.py.

00256 
00257     def start_cell(self, attrs):
00258         self.y = int(attrs.get("row"))
00259         self.x = int(attrs.get("col"))

def ss1.SheetParser.start_value (   self,
  attrs 
)

Definition at line 260 of file ss1.py.

00260 
00261     def start_value(self, attrs):
00262         self.fmt = attrs.get('format')
00263         self.alignment = xml2align.get(attrs.get('align'))

def ss1.SheetParser.startelement (   self,
  tag,
  attrs 
)

Definition at line 239 of file ss1.py.

00239 
00240     def startelement(self, tag, attrs):
00241         method = getattr(self, 'start_'+tag, None)
00242         if method:
00243             for key, value in attrs.items():
00244                 attrs[key] = str(value) # XXX Convert Unicode to 8-bit
00245             method(attrs)
00246         self.texts = []

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 262 of file ss1.py.

Definition at line 298 of file ss1.py.

Definition at line 261 of file ss1.py.

Definition at line 230 of file ss1.py.

Definition at line 264 of file ss1.py.

Definition at line 245 of file ss1.py.

Definition at line 268 of file ss1.py.

Definition at line 258 of file ss1.py.

Definition at line 257 of file ss1.py.


The documentation for this class was generated from the following file: