在报表中写数据

Posted skdev

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在报表中写数据相关的知识,希望对你有一定的参考价值。

 
case WM_NOTIFY:
                     LPNMITEMACTIVATE lpnmitem;
                  switch(LOWORD(wParam))
                     {
                     case ID_LIST:
                            lpnmitem=(LPNMITEMACTIVATE)lParam;
                            if(lpnmitem->hdr.code==NM_CLICK||lpnmitem->hdr.code==NM_SETFOCUS)
                            {    
                                   if(hListEdit!=NULL)
                                   {
                                          GetWindowText(hListEdit,buff,10);
                                          SetItemText(hDlg,curpos.x,curpos.y,buff);
                                          DestroyWindow(hListEdit);                                                   
                                          hListEdit=NULL;
                                   }
                                   curpos.x=lpnmitem->iItem;
                                   curpos.y=lpnmitem->iSubItem;
                                   if(curpos.y<1||curpos.x<0)
                                          return 0;
                                   Rect.top=lpnmitem->iSubItem;
                                   Rect.left=LVIR_BOUNDS;
                                   SendDlgItemMessage(hDlg,ID_LIST,LVM_GETSUBITEMRECT,(WPARAM)lpnmitem->iItem,(LPARAM)&Rect);
                                   hListView=GetDlgItem(hDlg,ID_LIST);
                                   hListEdit=CreateWindow("EDIT","",WS_CHILD|WS_BORDER|WS_VISIBLE,Rect.left,Rect.top,Rect.right-Rect.left,Rect.bottom-Rect.top,hListView,(HMENU)ID_LISTEDIT,hInst,NULL);
                                   lvi.mask=LVIF_TEXT;
                                   lvi.iItem=lpnmitem->iItem;        //行数
                                   lvi.iSubItem=lpnmitem->iSubItem;         //列数
                                   lvi.pszText=buff;       //文本
                                   lvi.cchTextMax=20;
                                   SendDlgItemMessage(hDlg,ID_LIST,LVM_GETITEMTEXT,lpnmitem->iItem,(LPARAM)(LPLVITEM)&lvi);
                                   SetWindowText(hListEdit,buff);
                                   SetFocus(hListEdit);
                            }
                            break;
                     }
                     break;
WM_COMMAND://取消编辑框
if(hListEdit!=NULL)
              {
                     GetWindowText(hListEdit,buff,10);
                     SetItemText(hDlg,curpos.x,curpos.y,buff);
                     DestroyWindow(hListEdit);                                                                        
                     hListEdit=NULL;
              }

 响应滚动条消息

hListView=GetDlgItem(hDlg,ID_LIST);
OldList=(WNDPROC)SetWindowLong(hListView,GWL_WNDPROC,(LPARAM)ListProc);//设置消息响应例程

LRESULT CALLBACK ListProc(HWND hList,UINT message,WPARAM wParam,LPARAM lParam)
{
 char buff[10];

 switch(message)
 {
 case WM_HSCROLL:
  if(hListEdit!=NULL)
  {
   GetWindowText(hListEdit,buff,10);
   SetItemText(hDlgMain,curpos.x,curpos.y,buff);
   DestroyWindow(hListEdit);            
   hListEdit=NULL;
  }
  break;
 }
 return CallWindowProc (OldList, hList, message, wParam, lParam) ; //其他消息返回原消息处理例程
}

以上是关于在报表中写数据的主要内容,如果未能解决你的问题,请参考以下文章

Python全栈100天学习笔记Day46 导入导出Excel报表和配置日志

Python全栈100天学习笔记Day46 导入导出Excel报表和配置日志

Python全栈100天学习笔记Day46 导入导出Excel报表和配置日志

Birt报表存储过程多选参数的设置

[水晶报表]为水晶报表(含子报表)绑定数据

在党内系统web单机版报表导出存在哪里