flag CReport::DoReport() { ASSERT_ALWAYS(Opt==Excel, "Only Excel Report", __FILE__, __LINE__); char Buff[512]; int i,j,iMax,jMax; Strng s, sTag, WrkTag, WrkCnvTxt, Separ; ASSERT(pConv); Separ = "\t"; int aa,bb; iMax = (bVert ? lALen : lBLen); jMax = (bVert ? lBLen : lALen); DWORD dwSize = 0; void* pData = NULL; char* pDat; flag CheckCells = 0 /*kga temp; still TODO */|| (sIgnoreChars.Length()>0); if (CheckCells) { sprintf(Buff, "R%dC%d:R%dC%d", iStartRow+1, iStartCol+1, iStartRow+iMax, iStartCol+jMax); pConv->Request(Buff, &pData, &dwSize); //request for all cells if (dwSize) {//got data... pDat = (char*)pData; //...TODO... retain special cells } else { pConv->Release(); // and it should get deleted ReportError(17L, "Unable to get cell contents %s", Buff); return False; } } for (i=0; i<iMax; i++) { s = ""; for (j=0; j<jMax; j++) { if (j>0) s += Separ; aa = (bVert ? i : j); bb = (bVert ? j : i); if (ATags[aa].Length()==0 || BTags[bb].Length()==0) s += sBlank; else { sTag = ATags[aa]; sTag += '.'; sTag += BTags[bb]; TaggedObject::SplitTagCnv(sTag(), WrkTag, WrkCnvTxt); CXM_ObjectTag ObjTag(WrkTag(), TABOpt_AllInfoOnce); CXM_ObjectData ObjData; CXM_Route Route; if (pDdeExec->XReadTaggedItem(ObjTag, ObjData, Route)) { CPkDataItem * pItem = ObjData.FirstItem(); if (pItem->Value()->IsNAN()) s += sNan; else s += pItem->Value()->GetString("%i", "%g", pItem->CnvIndex(), WrkCnvTxt()); } else s += sBlank; } } s += "\r\n"; sprintf(Buff, "R%dC%d:R%dC%d", i+iStartRow+1, iStartCol+1, i+iStartRow+1, iStartCol+jMax); if (!pConv->Poke(CF_TEXT, Buff, (void*)s(), s.Length() + 1)) { pConv->Release(); // and it should get deleted ReportError(16L, "Unable to send row %d", i+iStartRow+1); if (CheckCells) delete pData; return False; } } if (CheckCells) delete pData; ReportError(0L, ""); return True; }
bool CSlotConnect::Connect(CSlot * pSlot) { long iDot; long iSpc; bool MustBeLink=false; Strng RootTag,WrkCnvTxt; m_sTag.TrimLeft(" "); m_sTag.TrimRight(" "); if ((iSpc=m_sTag.Find(' '))>0) { TaggedObject::SplitTagCnv((LPSTR)(LPCSTR)m_sTag, RootTag, WrkCnvTxt); TaggedObject::ValidateTag(RootTag); if (RootTag.Length()>0) { MustBeLink=true; } } else { // may be a link or something else RootTag=m_sTag; } //m_lLink=-1; m_lCdBlk=-1; m_eSrc=eCSD_Slot; m_lSrcIndex=pSlot->m_lSlot; m_lDstIndex=-1; m_bValid=false; m_pCdBlk=NULL; m_pCdBlkVar=NULL; if (!MustBeLink) { long iSlot=gs_SlotMngr.FindSlot(m_sTag); if (iSlot>=0) { m_eDst=eCSD_Slot; m_lDstIndex=iSlot; if (m_bIsGet) { Exchange(m_eSrc, m_eDst); Exchange(m_lSrcIndex, m_lDstIndex); gs_SlotMngr.m_Slots[m_lSrcIndex]->m_ReflectedGets.Add(this); } m_bValid=true; goto Done; } //Split Tag & Variable iDot=m_sTag.Find('.'); if (iDot>0) { CString CdTag=m_sTag.Left(iDot); CString Variable=m_sTag.Mid(iDot+1); if ((m_lCdBlk=gs_SlotMngr.FindCdBlk(CdTag))>=0) { //CString CdTag=Tag; //CString Variable=Var; m_eDst=eCSD_CdBlk; m_pCdBlk=gs_SlotMngr.m_CdBlks[m_lCdBlk]; m_pCdBlkVar=m_pCdBlk->m_Code.m_pVarList->FindTag((LPSTR)(LPCSTR)Variable); if (!m_pCdBlkVar) { pSlot->SetError(SErr_CdBlkTagMissing, "CodeBlock Tag '%s' not Found", Variable); return (m_bValid=false); goto Done; } switch (m_pCdBlkVar->WhatAmI()) { case VarDouble: m_bCdBlkVarFlt=true; break; case VarLong : case VarByte : case VarBit : m_bCdBlkVarFlt=false; break; default : pSlot->SetError(SErr_CdBlkTagBadType, "CodeBlock Tag '%s' Bad Type", Variable); m_bValid=false; goto Done; break; } if (m_bIsGet) { Exchange(m_eSrc, m_eDst); Exchange(m_lSrcIndex, m_lDstIndex); gs_SlotMngr.m_CdBlks[m_lCdBlk]->m_ReflectedGets.Add(this); } m_bValid=true; goto Done; } } } m_bValid=true; m_eDst=eCSD_Link; if (1) { CString LinkTag; if (0) { LinkTag=RootTag(); long i; while ((i=LinkTag.FindOneOf("."))>=0) LinkTag.SetAt(i, '_'); } else LinkTag = pSlot->m_sTag; m_lDstIndex=gs_SlotMngr.AddLink(pSlot, LinkTag, RootTag(), WrkCnvTxt(), pSlot->Type(), m_bIsGet, m_bIsSet); if (m_lDstIndex>=0) { if (m_bIsGet) { Exchange(m_eSrc, m_eDst); Exchange(m_lSrcIndex, m_lDstIndex); //EXCHANGE(eConnSrcDst, m_eSrc, m_eDst); //EXCHANGE(long, m_lSrcIndex, m_lDstIndex); gs_SlotMngr.m_Links[m_lSrcIndex]->m_ReflectedGets.Add(this); if (m_eSrc==eCSD_Link) { CLink &L=*gs_SlotMngr.m_Links[m_lSrcIndex]; CSlotConnArray &RGs=L.m_ReflectedGets; for (int rg=0; rg<RGs.GetSize(); rg++) { CSlotConnOpArray &Ops=RGs[rg]->m_Ops; for (int op=0; op<Ops.GetSize(); op++) { if (Ops[op]->IsConditioning()) { L.m_CondBlk.m_On = true; L.m_CondBlk.m_BaseValueValid = false; } } } } } else { } } } Done: //Dump(" "); return m_bValid; }