'typedef struct _formatrange {
HDC hdc;
HDC hdcTarget;
RECT rc;
RECT rcPage;
CHARRANGE chrg;} FORMATRANGE;'

def FormatRange(self, dc, pageStart, lengthDoc, rc, draw):

    fmt = 'PPIIIIIIIIll'
    hdcRender = dc.GetHandleOutput()
    hdcFormat = dc.GetHandleAttrib()
    fr = struct.pack(fmt, hdcRender, hdcFormat, rc[0], rc[1], rc[2], rc[3], rc[0], rc[1], rc[2], rc[3], pageStart, lengthDoc)
    nextPageStart = self.SendScintilla(EM_FORMATRANGE, draw, fr)
    return nextPageStart
