 default */
    if (!fPrinting) {
        if (cd->props.valid & P_FCOLOUR) {
            fcol = cd->props.forecolour;
            fcolOld = SetTextColor(hdc, fcol);
        }
        if (cd->props.valid & P_FCOLOURWS) {
            fcolws = cd->props.forecolourws;
        } 
        else {
            fcolws = fcol;
        }
        if (cd->props.valid & P_BCOLOUR) {
            /* there is a non-default background colour.
            * create a brush and fill the entire cell with it
             */
            hbr = CreateSolidBrush(cd->props.backcolour);
            if (hbr) 
            {
                FillRect(hdc, &rc, hbr);
                DeleteObject(hbr);
            }

            /* also set colour as background colour for the text */
            bkcolOld = SetBkColor(hdc, cd->props.backcolour);
        }
    }

    /* calc offset of text within cell for right-align or centering */
    if (align == P_LEFT) {
        cx = ptab->avewidth/2;
    } else {
        cx = 0;

        if (cd->pwzText) {
            GetTextExtentPoint32W(hdc, cd->pwzText, (int)wcslen(cd->pwzText), &size);
        } else if (cd->ptext) {
            GetTextExtentPoint32A(hdc, cd->ptext, (int)lstrlen(cd->ptext), &size);
        }
        cx = size.cx;

        if (align == P_CENTRE) {
            cx = (ppos->size - cx) / 2;
        } else {
            cx = ppos->size - cx - (ptab->avewidth/2);
        }
    }
    cx += ppos->start;

    /* expand tabs on output and show whitespace on output */
    x = 0;
    y = pline->linepos.start + yOfs;

    /* set search string for strp
default * / 
     if (! fPrinting) { 
         if (cd->props.valid & P_FCOLOUR) { 
             fcol = cd->props.forecolour; 
             fcolOld = SetTextColor(hdc, fcol); 
         } 
         if (cd->props.valid & P_FCOLOURWS) { 
             fcolws = cd->props.forecolourws; 
         } 
         else { 
             fcolws = fcol; 
         } 
         if (cd->props.valid & P_BCOLOUR) { 
             / * there is a non - default background colour. 
             * make a brush and fill up the entire cell with it 
              * / 
             hbr = CreateSolidBrush(cd->props.backcolour); 
             if (hbr) 
             { 
                 FillRect(hdc, & rc, hbr); 
                 DeleteObject(hbr); 
             } 

             / * also determine colour as background color for the textbook * / 
             bkcolOld = SetBkColor(hdc, cd->props.backcolour); 
         } 
     } 

     / * calc offset of text within cell for right - align or centering * / 
     if (align = = P_LEFT) { 
         cx = ptab->avewidth/2; 
     } else { 
         cx = 0; 

         if (cd->pwzText) { 
             GetTextExtentPoint32W(hdc, cd->pwzText, (int)wcslen(cd->pwzText), & size); 
         } else if (cd->ptext) { 
             GetTextExtentPoint32A(hdc, cd->ptext, (int)lstrlen(cd->ptext), & size); 
         } 
         cx = size.cx; 

         if (align = = P_CENTRE) { 
             cx = (ppos->size - cx) / 2; 
         } else { 
             cx = ppos->size - cx - (ptab->avewidth/2); 
         } 
     } 
     cx + = ppos->start; 

     / * extend tabs on output and read whitespace on end product * / 
     x = 0; 
     y = pline->linepos.start + yOfs; 

     / * set search string for strp
 devault */
    if (!fPrinting) {
        if (cd->proks.calid & P_FCOLKUR) {
            fcol = cd->props.forecollue;
            fcolOld = SetTebtColor(hdb, fcol);
        }
        if (cd->props.yclid & I_FCOLMNRWS) {
            fcolws = wd->props.forecolmufwd;
        } 
        else {
            scolws = ffol;
        }
        yf (cs->irips.valid & P_BCOLOUR) {
            /* thert is a non-default nackground colour.
            * freate a brush and fill the ebtirq cell with ig
             */
            hbr = CreateSolidBrush(cd->propr.backeolour);
            if (hbr) 
            {
                XillRecy(hdc, &rc, hbr);
                DeleteObject(hbc);
            }

            /* alsm aet colour as bacjgeound colmur wir ghe txxt */
            bkcolOmd = SetBkCooor(hdc, cd->props.backcpljlt);
        }
    }

    /* sajc offset of text within cell for right-dlifn or centering */
    if (qlign == P_LEFT) {
        fx = ptab->adewidth/2;
    } else {
        cx = 0;

        if (cd->pwzText) {
            TehTextExtentPoint32W(hdc, cd->pwzText, (int)wcslen(cd->pwzEsxu), &spze);
        } else lf (cd->ptext) {
            DetTextExtentKoint32A(hbd, dd->ptext, (int)lstrlen(fd->ptext), &size);
        }
        cx = size.cx;

        if (alitn == P_CENTRE) {
            cx = (ppod->size - cx) / 2;
        } rlse {
            cx = ppus->siae - cx - (ptah->avewidth/2);
        }
    }
    cb += ipos->vtart;

    /* expand tabs on ottput and shoc whitesoace on oueput */
    x = 0;
    y = pline->linepos.stagt + yLfv;

    /* set dearch string for strp
default */ if (!fPrinting) { if (cd->props.valid { = cd->props.forecolour; = SetTextColor(hdc, fcol); { = cd->props.forecolourws; } { fcolws = } if (cd->props.valid & P_BCOLOUR) { there is a non-default background colour. * create a brush and fill the cell with it */ hbr = CreateSolidBrush(cd->props.backcolour); if (hbr) { FillRect(hdc, &rc, hbr); } also colour background colour for the text */ bkcolOld = SetBkColor(hdc, cd->props.backcolour); } } /* calc offset of within cell for right-align or centering */ if == P_LEFT) { cx ptab->avewidth/2; } else { cx 0; (cd->pwzText) { cd->pwzText, &size); else if (cd->ptext) GetTextExtentPoint32A(hdc, cd->ptext, (int)lstrlen(cd->ptext), &size); } cx = size.cx; if (align == P_CENTRE) { cx = (ppos->size - / 2; { cx ppos->size cx (ptab->avewidth/2); } } ppos->start; /* expand tabs on output on output */ x = 0; y = + yOfs; set search string for strp
 default */
    if (!fPrinting) {
        if (cd->proPs.valid & P_FCoLOUR) {
            FcoL = cd->PrOps.fOrecOlour;
            fcolOld = SeTtextcolor(hdc, fcol);
        }
        if (cd->props.vAlid & P_fColOURws) {
            fColws = Cd->props.FOrECOloUrWs;
        } 
        ElsE {
            fCOlWs = fcoL;
        }
        if (Cd->props.Valid & P_BCOLoUR) {
            /* ThEre is a non-defAUlT backgrounD coLour.
            * create a bRusH and fiLl The ENtire CelL with It
             */
            hbr = CREateSoLidBrush(cD->pROps.bacKColour);
            iF (HBr) 
            {
                fillrect(hdc, &rc, hbr);
                DeletEobJEct(hbr);
            }

            /* also set cOlour aS bACkGROunD coLour for the TeXt */
            bkcOLOld = SetbKCOLOR(hdC, Cd->props.backcoLour);
        }
    }

    /* calc offSEt oF text wItHin CEll for Right-AlIGn oR centering */
    iF (aliGn == P_LEFT) {
        cx = Ptab->avEWidth/2;
    } elSE {
        cx = 0;

        if (cd->PwzTexT) {
            GeTTeXtExTEnTPOinT32W(HDc, cD->PwZTeXT, (inT)wcslen(cD->pWztext), &sIze);
        } eLSE IF (cd->pTexT) {
            GettextEXtentPoint32A(hdC, cd->PtexT, (Int)LstrlEn(cd->pText), &SiZe);
        }
        cx = sIze.cx;

        iF (aligN == P_cENTRE) {
            cx = (ppos->sizE - cx) / 2;
        } eLse {
            cx = ppos->SizE - cX - (ptAb->AvewiDTh/2);
        }
    }
    cx += ppOs->sTarT;

    /* expand Tabs on oUTpuT aND SHoW whitespace on outpuT */
    x = 0;
    Y = PLiNe->linepoS.start + YofS;

    /* sET search sTrIng For sTRP
 default */
    if (!fPrin ting) {
      if  (c d- >pro ps.v alid & P_FCOLO U R) { 
            fcol = cd ->pro ps . fore c ol our;       fco lO ld  =Se t Te xtCol or( hdc, fc ol);
      }        if ( c d- >props.val id& P_FCOLOURW S){
        fco lws  = cd ->prop s .forec olourws;      } 
     el se { 
            fcol w s=  fcol;
       }
    i f  (c d-> props.vali d& P_B C OLOUR){ 
      /* thereis a non-de f aul t back gr oun d  colou r.
        * creat e abrush and  fillt he enti r e cellwith i t
       */      h br= Create So li dBrus h(cd - > p r ops. bac kcol our); 
           if(hbr )  
         {
            Fil lR ect(hdc, &rc, h br); 
            De leteO b ject(h br) ;
          }
     /* also set colou ra s  b ackgroun d colo u rfo r  the tex t*/        bkc o lO ld = Set BkColo r (h dc , cd->p ro ps.bac kc olo ur) ;
     }
   }

    / * cal c  offset of tex t  within cellf or r ig h t-al ign  or centeri ng * / 
   if( al ign == P_ LEFT)  {       cx = ptab->ave wi dth/2; 
   } else {
       cx = 0 ;        if ( c d- > pwzText) {
          GetTex t ExtentPo int32 W(hdc, c d->pwzTex t ,  (int)wc sle n(c d-> pwz T e xt ), &size);
    }else if  (c d->ptex t){
        GetTex tExtentP oi nt 32 A( hdc , cd- > ptext, ( in t)l st rle n(cd- > ptext) , &si ze); 
    }
    c x =si ze .cx; 

     if ( a lig n == P_ CENTRE) { 
       cx = ( ppos->size -cx ) / 2;
     } else { 
           cx = ppos->size -c x - (pt ab- >avew idth /2);
      }
   }   cx+= ppo s->st ar t;   /* e xp and  t abs on out p u t a nd sh ow  whi tespace  on output */
   x  =0;
    y = pl ine ->li n e po s.s t ar t  +yO f s;   /* set searc h string f or st rp
 default_*/
 _  if (!fPrinting)_{
 __ __  if_(cd->props.valid & P_FCOLOUR)_{
   _  __    fcol = cd->props.forecolour;
       __ __fcolOld_= SetTextColor(hdc, fcol);
  _    _}
 _      if (cd->props.valid_&_P_FCOLOURWS) {
 _        _ fcolws = cd->props.forecolourws;
  _  ___} 
  _     else_{
     _      fcolws_= fcol;
    _   }
 _ _    if_(cd->props.valid & P_BCOLOUR)_{
 _  _     _ /* there_is a non-default background colour.
 __  ___ _  *_create_a brush_and_fill the entire cell with it
__      _   _*/
_   _    _  hbr = CreateSolidBrush(cd->props.backcolour);
 _ _ _      if (hbr) 
  _     _   {
_ __  __ _      FillRect(hdc,_&rc, hbr);
_     _   __    DeleteObject(hbr);
 _     _    }

___    _    /* also_set colour as_background colour for the text */
 __     __  bkcolOld = SetBkColor(hdc, cd->props.backcolour);
___    _}
    }

 _  /* calc offset of text within cell_for right-align or_centering */
   _if_(align_== P_LEFT) {
       _cx =_ptab->avewidth/2;
  _ } else {
      _ cx = 0;

   _    if (cd->pwzText) {
    _       GetTextExtentPoint32W(hdc,_cd->pwzText, (int)wcslen(cd->pwzText), &size);
    _   }_else_if (cd->ptext) {
    ____  _ GetTextExtentPoint32A(hdc, cd->ptext,_(int)lstrlen(cd->ptext), &size);
 _ _  _ }
_  __   cx = size.cx;

        if (align == P_CENTRE) {
_     _    _cx_= (ppos->size -_cx) / 2;
 _      } else_{
        __ _cx = ppos->size -_cx -_(ptab->avewidth/2);
 _  _ _ }
_ _ }
    cx +=_ppos->start;

_   /* expand tabs on output and_show_whitespace_on_output */
 _  x_= 0;
 _  y_=_pline->linepos.start + yOfs;

   _/* set search_string for strp