From 8b9dbecc0e75ccf6fcaaf75cd7e4739346a0298e Mon Sep 17 00:00:00 2001 From: xj qian <qianxj15@sina.com> Date: 星期一, 08 七月 2024 11:16:33 +0800 Subject: [PATCH] report --- jrj/project/total3/ViewTotalWin.cpp | 523 +++++++++++++++++++++++++++++++++++++ jrj/xframe/xcontrol/xoffice.hpp | 109 +++++++ jrj/project/analysis/DataVanalysisWin.cpp | 141 ++++++++++ jrj/ext-jrj/ext-jrj.vcxproj | 4 jrj/xframe/kobject/koffice.hpp | 37 ++ 5 files changed, 814 insertions(+), 0 deletions(-) diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj index ba7c9d7..dd1a013 100644 --- a/jrj/ext-jrj/ext-jrj.vcxproj +++ b/jrj/ext-jrj/ext-jrj.vcxproj @@ -185,6 +185,7 @@ <ClInclude Include="..\xframe\kobject\khtml.hpp" /> <ClInclude Include="..\xframe\kobject\klayersheet.hpp" /> <ClInclude Include="..\xframe\kobject\knode.hpp" /> + <ClInclude Include="..\xframe\kobject\koffice.hpp" /> <ClInclude Include="..\xframe\kobject\kpage.hpp" /> <ClInclude Include="..\xframe\kobject\kreport.hpp" /> <ClInclude Include="..\xframe\kobject\kshtml.hpp" /> @@ -235,6 +236,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> </ClInclude> <ClInclude Include="..\xframe\xcontrol\xlistview.hpp" /> + <ClInclude Include="..\xframe\xcontrol\xoffice.hpp" /> <ClInclude Include="..\xframe\xcontrol\xreport.hpp" /> <ClInclude Include="..\xframe\xcontrol\xshtml.hpp" /> <ClInclude Include="..\xframe\xcontrol\xtreeview.hpp" /> @@ -242,6 +244,7 @@ <ClInclude Include="pch.h" /> </ItemGroup> <ItemGroup> + <ClCompile Include="..\project\analysis\DataVanalysisWin.cpp" /> <ClCompile Include="..\project\business\AP\APBank.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> </ClCompile> @@ -535,6 +538,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\project\start.vframe.vbusiness.cpp" /> + <ClCompile Include="..\project\total3\ViewTotalWin.cpp" /> <ClCompile Include="..\project\viewobject\view.base.hpp" /> <ClCompile Include="..\project\vindexform.cpp" /> <ClCompile Include="..\project\vindexformex.cpp" /> diff --git a/jrj/project/analysis/DataVanalysisWin.cpp b/jrj/project/analysis/DataVanalysisWin.cpp new file mode 100644 index 0000000..d1532db --- /dev/null +++ b/jrj/project/analysis/DataVanalysisWin.cpp @@ -0,0 +1,141 @@ +#include <wobject/xwin.hpp> +#include <xcontrol/xdwgrid.hpp> +#include <xcontrol/xflowchart.hpp> +#include <xcontrol/ximageview.hpp> +#include <xcontrol/ximageview.hpp> +#include <xcontrol/xhtml.hpp> +#include <xcontrol/xexcel.hpp> +#include "vbusiness/util/publiccode.vutil.vbusiness.hpp " + +using xml = KXMLDOMDocument; +class __declspec(dllexport) DataVanalysisWin : public xwin +{ +public: + DataVanalysisWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} + static DataVanalysisWin* CreateInstance(void* implPtr, void* hWnd) + { + return new DataVanalysisWin(implPtr, (HWND)hWnd); + } +public: + xhtml ole_html; + xdwgrid dw_data; + xnode m_agentNode; //Agent Condition + xstring htmlStr; + xexcel excel; + + int SetAgent() + { + xstring xfNodeAgentArea = L"agentarea"; + xnode anode = GetAgentNode(xfNodeAgentArea); + if (m_agentNode) + { + SetAgentNode(anode, m_agentNode); + } + else + { + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); + if (agent) + { + xstring s = agent.xml(); + m_agentNode = SetAgentNode(anode, s); + } + } + return 1; + } + + //焦点激活处理函数 + int OnSetFocus(TEvent* evt, int param) + { + //重置工具条 + SetAgent(); + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + HCURSOR hCursor = xutil::SetCursorWait(); + if (comdid == L"xmConfig") + { + xstring str = dw_data.DataAnalysis(L""); + if (str != L"") + { + ole_html.LoadHtml(str); + htmlStr = str; + } + return 1; + } + else if (comdid == L"xmCopy") + { + ole_html.ExecWB(12, 0); //OLECMDID_COPY + xutil::RestoreCursor(hCursor); + return 1; + } + else if (comdid == L"xmSelectAll") + { + ole_html.ExecWB(17, 0); //OLECMDID_SELECTALL + xutil::RestoreCursor(hCursor); + return 1; + } + else if (comdid == L"xmToExecl") + { + if (!excel.GetNativePtr()) + { + alert(L"不能连接Excel"); + return 1; + } + + xaserver::CreateDirectory(L"C:\\Temp"); + xstring gid = publiccode::GetGuid(); + xutil::SaveToFile(L"C:\\Temp\\" + gid + L".html", htmlStr, L"", L"", L""); + excel.OpenDocument(L"C:\\Temp\\" + gid + L".html"); + excel.put_Visible(true); + return 1; + } + + xutil::RestoreCursor(hCursor); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, int param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&DataVanalysisWin::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&DataVanalysisWin::OnSetFocus); + } + + int onload() + { + htmlStr = L""; + ole_html = GetControl(L"ole_html"); + if (!GetWinParam()) return 1; + SetArg(); + xaserverarg arg = GetArg(); + xstring str = arg.GetArgString(L"html"); + if (str != L"") + { + htmlStr = str; + ole_html.LoadHtml(str); + } + dw_data = *(xdwgrid*)arg.GetParam(L"obj"); + + OnAttachEvent(); + + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/total3/ViewTotalWin.cpp b/jrj/project/total3/ViewTotalWin.cpp new file mode 100644 index 0000000..d330173 --- /dev/null +++ b/jrj/project/total3/ViewTotalWin.cpp @@ -0,0 +1,523 @@ +#include <wobject/xwin.hpp> +#include <xcontrol/xdwgrid.hpp> +#include <xcontrol/xoffice.hpp> +#include <xcontrol/xcell.hpp> +#include <xcontrol/xflowchart.hpp> +#include <xcontrol/ximageview.hpp> + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ViewTotalWin : public xwin +{ +public: + ViewTotalWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} + static ViewTotalWin* CreateInstance(void* implPtr, void* hWnd) + { + return new ViewTotalWin(implPtr, (HWND)hWnd); + } + + xdwgrid dw_list; + xoffice dw_office; + xcell dw_cell; + xnode m_agentNode; //Agent Condition + KXMLDOMElement rptEle; + string m_category; + string argStr; + string searchStr; + string fieldRoleStr; + int hWndImageView; + int hWndRetrieveTip; + bool dataretrieveing; + + int SetAgent() + { + string xfNodeAgentArea = L"agentarea"; + xnode anode = GetAgentNode(xfNodeAgentArea); + if (m_agentNode) + { + SetAgentNode(anode, m_agentNode); + } + else + { + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); + if (agent) + { + string s = agent.xml(); + m_agentNode = SetAgentNode(anode, s); + } + } + return 1; + } + + int OnSearch() + { + xaserverarg arg = new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"text", searchStr); + //trace(searchStr); + OpenWindow(L"dev:xpage[search.dialog.vx]", cast(arg as int)); + string str = arg.GetArgString(L"text"); + if (str != searchStr) + { + searchStr = str; + dw_list.Filter(L"*", searchStr); + return 1; + } + return 1; + } + + //焦点激活处理函数 + int OnSetFocus(ref TEvent evt, int param) + { + //重置工具条 + SetAgent(); + return 1; + } + + //命令发布函数 + int OnCmdDispatch(string comdid) + { + string UserNo = publiccode::GetUser().no; + + int hCursor = 0; + if (comdid == L"xmSearch") return OnSearch(); + + //if(UserNo !=L"00603") + //{ + if (comdid == L"xmAnalysis") + { + hCursor = xutil::SetCursorWait(); + string str = dw_list.DataAnalysis(L""); + xaserverarg arg = new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"html", str); + int obj = cast(dw_list as int); + arg.AddArg(L"obj", obj.toString()); + OpenWindow(L"dev:xpage[data.vanalysis.vx]", cast(arg as int)); + xutil::RestoreCursor(hCursor); + return 1; + } + if (comdid == L"xmSaveAs") + { + dw_list.SaveAs(L""); + return 1; + } + if (comdid == L"xmRemarks") + { + string name = rptEle.getAttribute(L"name"); + xml x = ViewObject::RetrieveData(L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); + KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"data/Item"); + KXMLDOMNode t = items.item(0); + string Content = L""; + if (t.selectSingleNode(L"Content")) + { + Content = t.selectSingleNode(L"Content").text; + } + + xaserverarg arg1 = new xaserverarg; + arg1.setNativePointer(arg1.CreateInstance()); + arg1.AddArg(L"value", Content); + OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1.getNativePointer()); + return 1; + + } + //} + if (comdid == L"xmTrans1") + return OnTransData(); + if (comdid == L"xmQuery") + { + if (rptEle) + { + string argUrl = rptEle.getAttribute(L"arg"); + if (argUrl != L"") + { + xaserverarg ar = new xaserverarg; + ar.setNativePointer(ar.CreateInstance()); + ar.AddArg(L"argurl", argUrl); + if (argStr != L"") + ar.AddArg(L"arg", argStr); + OpenWindow(L"dev:xpage[view.total.arg.vx]", cast(ar as int)); + string arstr = ar.GetArgString(L"arg"); + if (arstr != L"" && ar.GetArgString(L"action") == L"ok") + { + argStr = arstr; + hCursor = xutil::SetCursorWait(); + //trace(rptEle.getAttribute(L"data")); + OnRetrieve(rptEle.getAttribute(L"data"), argStr); + xutil::RestoreCursor(hCursor); + } + } + else + { + argStr = L""; + OnRetrieve(rptEle.getAttribute(L"data"), argStr); + } + } + return 1; + } + if (comdid == L"xmLookImage") + { + + int row = dw_list.GetRow(); + string skuid = dw_list.GetGuid(row); + OnLookImage(skuid); + return 1; + } + if (comdid == L"CalculationFormula") + { + OpenWindow(L"dev:xpage[CalculationFormula.vx]", 0); + SetAgent(); + return 1; + } + return 0; + } + + int OnLookImage(string skuid) + { + int hCursor = xutil::SetCursorWait(); + xaserverarg arg = ViewObject::MakeArg(); + arg.AddArg(L"guid", skuid); + OpenWindow(L"dev:xpage[ViewPictures.vx]", arg.getNativePointer()); + xutil::RestoreCursor(hCursor); + return 1; + } + + int AdjustField(xdwgrid dw) + { + string str = fieldRoleStr; + for (int i = 1; i < dw.GetColumnCount(); i++) + { + string colname = dw.GetColumnName(i); + if (str.find(L"!" + colname + L",L") >= 0) + { + dw.SetColumnState(colname, false); + } + } + return 1; + } + + int SwitchReport(KXMLDOMElement e) + { + string dwname = e.getAttribute(L"template"); + string dataurl = e.getAttribute(L"data"); + string sheettype = e.getAttribute(L"reporttype"); + if (rptEle != e) + { + argStr = L""; + rptEle = e; + } + if (sheettype == L"") sheettype = L"report"; + SwitchLayer(L"dw_" + sheettype, L"report"); + if (sheettype == L"report")dw_list.openUrl(dwname); + if (hWndImageView) win32::DestroyWindow(hWndImageView); + + AdjustField(dw_list); + + SetAgent(); + return 1; + } + + int OnCombboChanged(ref TCommandEvent evt, int lParam) + { + int h = xcombobox::GetCurSel(evt.hCtrl); + if (h > -1) + { + int hCursor = xutil::SetCursorWait(); + KXMLDOMElement e = xcombobox::GetItemData(evt.hCtrl, h); + SwitchReport(e); + win32::PostMessage(GetHWND(), 0x401, L"xmQuery", 0); + //OnCmdDispatch(L"xmQuery"); + xutil::RestoreCursor(hCursor); + } + return 1; + } + + int OnTransData() + { + int ret = win32::MessageBox(GetHWND(), L"是否更新数据?\n更新过程预计需要四十分钟,如果中间弹出等待时间过长的提示,请点击中间重试按钮,或等待到一定时间再点击", L"提示", 0x4 /*yesno*/); + if (ret != 6 /*IDYES */) return 1; + + xml x = new.xml(); + x.setNativePointer(xml::CreateInstance()); + int hCursor = xutil::SetCursorWait(); + if (url::get(L"/sale/data/Total3/total/transdata", L"", x) != 1) + { + xutil::RestoreCursor(hCursor); + return 1; + } + else + { + xutil::RestoreCursor(hCursor); + alert(L"数据传输完成!"); + return 1; + } + + return 1; + } + + //命令处理事件 + int OnXCommand(ref TXCommandEvent evt, int param) + { + return OnCmdDispatch(evt.pStrID); + } + + int SendImageMessage(int row) + { + if (dw_list.GetItemString(row, L"GDNLineID") != L"") + win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GDNLineID:" + dw_list.GetItemString(row, L"GDNLineID"), 0); + else if (dw_list.GetItemString(row, L"ItemID") != L"") + win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"ItemID"), 0); + else if (dw_list.GetItemString(row, L"SKUID") != L"") + win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"SKUID"), 0); + else if (dw_list.GetItemString(row, L"GoodsNo") != L"") + win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GoodsNo:" + dw_list.GetItemString(row, L"GoodsNo"), 0); + return 1; + } + + int OnDWClick(ref TNotifyEvent evt, int p) + { + ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); + string value = hdr.data; + string colname = hdr.colname; + int row = hdr.row; + + if (row < 1) return 1; + + if (rptEle) + { + string str = rptEle.getAttribute(L"forward"); + if (str == L"false") return 1; + } + + /* + string s = publiccode::GetUser().id; + xml supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType",L"id", s); + if(supplier_x.GetXmlDoc().text == L"样品间" || supplier_x.GetXmlDoc().text == L"主管"){ + return 1; + } + + xaserverarg arg; + if(colname==L"SONo") + { + string SONo = dw_list.GetItemString(row,colname); + arg=new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"EntityNo",SONo); + arg.AddArg(L"ReadOnly",L"true"); + OpenWindow(L"dev:xpage[base.maint.so.vx]",arg.getNativePointer()); + } + if(colname==L"InvoiceNo") + { + string InvoiceNo= dw_list.GetItemString(row,colname); + arg=new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"EntityNo",InvoiceNo); + arg.AddArg(L"ReadOnly",L"true"); + OpenWindow(L"dev:xpage[maint.GDN3.vx]",arg.getNativePointer()); + } + if(colname==L"InvoiceNoEx") + { + string InvoiceNoEx= dw_list.GetItemString(row,colname); + arg=new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"EntityNo",InvoiceNoEx); + arg.AddArg(L"invoiceno",InvoiceNoEx); + arg.AddArg(L"ReadOnly",L"true"); + OpenWindow(L"dev:xpage[maint.vatnotify.vx]",arg.getNativePointer()); + } + */ + + if (hWndImageView != 0 && win32::IsWindow(hWndImageView)) + { + SendImageMessage(row); + } + else if (colname == L"HasImage") + { + xwin pwin = OpenWindow(L"dev:xpage[testImage.vx]", 0); + hWndImageView = pwin.GetHWND(); + SendImageMessage(row); + } + + return 1; + } + + int OnRowChanged(ref TNotifyEvent evt, int p) + { + + ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); + int row = hdr.row; + if (row < 1) return 1; + + if (hWndImageView != 0 && win32::IsWindow(hWndImageView)) + { + SendImageMessage(row); + } + return 1; + } + + int ShowRetrieveingTip() + { + dataretrieveing = true; + xwin pwin = OpenWindow(L"dev:xpage[TestRetrieveing.vx]", 0); + hWndRetrieveTip = pwin.GetHWND(); + return 1; + } + int CloseRetrieveTip() + { + dataretrieveing = false; + win32::SendMessage(hWndRetrieveTip, 0x401, L"RetrieveFinished", 0); + hWndRetrieveTip = 0; + + return 1; + } + + int OnRetrieveFinished(ref TNotifyEvent evt, int p) + { + CloseRetrieveTip(); + //dataretrieveing = false; + //alert(L"读取完成"); + return 1; + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", OnSetFocus); + AttachEvent(L"cb_report", L"CBN_SELCHANGE", OnCombboChanged); + AttachEvent(L"dw_report", L"DWV_CLICKED", OnDWClick); + AttachEvent(L"dw_report", L"DWV_ROWFOCUSCHANGED", OnRowChanged);//绑定行更改触发事件OnRowChanged + AttachEvent(L"dw_report", (0x400 + 81).toString(), OnRetrieveFinished); + } + + int OnRetrieve(string dataurl, string argstr) + { + if (!rptEle) return 0; + if (dataretrieveing) return -1; + dw_list.Reset(); + + xml x = new.xml(); + x.setNativePointer(xml::CreateInstance()); + xaserverarg arg = new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"arg", argstr); + trace(argstr); + string sheettype = rptEle.getAttribute(L"reporttype"); + if (sheettype == L"") sheettype = L"report"; + //ShowRetrieveingTip(); + if (url::get(dataurl, arg.GetString(), x) != 1) + { + + trace(L"错误信息=L" + x.GetXmlDoc().text); + dw_list.Redraw(); + return -1; + } + else + { + if (sheettype == L"report") + { + //CloseRetrieveTip(); + dw_list.Retrieve(x); + dw_list.Redraw(); + dw_list.SetReadOnly(true); + } + else if (sheettype == L"cell") + { + } + else if (sheettype == L"office") + { + dw_office.LoadTemplate(x); + for (int i = 0; i < dw_office.GetSheetCount(); i++) + { + xcell sheet = dw_office.GetSheet(i); + sheet.SetReadOnly(true); + } + } + } + return 1; + } + + xml getReportSet(string category) + { + xml x = new.xml(); + x.setNativePointer(xml::CreateInstance()); + xaserverarg arg = new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"category", category); + if (url::get(L"/sale/data/Total3/reportset", arg.GetString(), x) != 1) + { + return 0; + } + return x; + } + + string GetReportFieldRole() + { + xml x = new.xml(); + x.setNativePointer(xml::CreateInstance()); + xaserverarg arg = new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + if (url::get(L"/sale/data/Total3/report/field", arg.GetString(), x) != 1) + { + return ""; + } + string str = x.GetXmlDoc().text; + return str; + } + + int onload() + { + dw_list = GetControl(L"dw_report"); + dw_office = GetControl(L"dw_office"); + dw_cell = GetControl(L"dw_cell"); + dw_list.openUrl(L"/sale/view/Total3/template/sodetail"); + + fieldRoleStr = GetReportFieldRole(); + + argStr = L""; + rptEle = 0; + xcombobox xc = GetControl(L"cb_report"); + + m_category = L"total/trade"; + if (GetParam()) { + xaserverarg arg = new xaserverarg; + arg.setNativePointer(GetParam()); + m_category = arg.GetArgString(L"category"); + } + xml x = getReportSet(m_category); + if (x) + { + KXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes(L"//reports/report"); + int len = nlist.length; + for (int i = 0; i < len; i++) + { + KXMLDOMElement rpt = nlist.item(i); + string name = rpt.getAttribute(L"name"); + xcombobox::AddItem(xc.GetId(), name, trust(rpt as int)); + if (i == 0) xc.SetText(name); + if (i == 0) rptEle = rpt; + } + } + searchStr = L""; + hWndImageView = 0; + hWndRetrieveTip = 0; + dataretrieveing = false; + OnAttachEvent(); + + return 1; + } + + int onloaded() + { + SetAgent(); + + if (rptEle) + { + SwitchReport(rptEle); + //OnCmdDispatch(L"xmQuery"); + } + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/xframe/kobject/koffice.hpp b/jrj/xframe/kobject/koffice.hpp new file mode 100644 index 0000000..9c0ada7 --- /dev/null +++ b/jrj/xframe/kobject/koffice.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "kcontrol.hpp" +namespace Hxsoft { namespace XFrame { namespace XOffice { + + class IXOffice : public IXFControl + { + public: + int LoadTemplate(LPTSTR pXml, int state); + int LoadTemplate(KXMLDOMElement pElement, int state); + int LoadTemplate(KXMLDOMDocument& x, int state); + public: + int Retrieve(KXMLDOMElement pElement); + int Retrieve(KXMLDOMDocument& x); + int Retrieve(LPTSTR bstr); + public: + int DwUpdate(KXMLDOMElement pElement); + int DwUpdate(KXMLDOMDocument& x); + public: + xbObject* GetSheet(int nIndex); + int GetSheetCount(); + public: + int SelectSheet(int nIndex); + int GetSelectedSheetIndex(); + int RemoveSheet(int nIndex); + public: + int GetData(KXMLDOMDocument px); + int GetData(KXMLDOMDocument px, int nIndex); + public: + int SaveFileAs(); + int SaveFile(); + int SaveFile(wchar_t* fileName); + public: + int OpenFile(wchar_t* fileName); + int OpenFile(); + }; +}}} diff --git a/jrj/xframe/xcontrol/xoffice.hpp b/jrj/xframe/xcontrol/xoffice.hpp new file mode 100644 index 0000000..0053892 --- /dev/null +++ b/jrj/xframe/xcontrol/xoffice.hpp @@ -0,0 +1,109 @@ +#pragma once + +#include "wobject/xcontrol.hpp" +#include "kobject/koffice.hpp" +#include "wobject/xurl.hpp" + +using koffice = Hxsoft::XFrame::XOffice::IXOffice; +class xoffice : public xcontrol +{ +public: + xoffice() :xcontrol(nullptr) {} + xoffice(void* implptr) :xcontrol(implptr) {} +public: + koffice* GetKOffice() + { + return (koffice*)this->GetNativePtr(); + } +public: + int LoadTemplate(xstring pXml, int state) + { + return GetKOffice()->LoadTemplate((LPTSTR)pXml.c_str(), state); + } + int LoadTemplate(KXMLDOMElement pElement, int state) + { + return GetKOffice()->LoadTemplate(pElement, state); + } + int LoadTemplate(KXMLDOMDocument& x, int state) + { + return GetKOffice()->LoadTemplate(x, state); + } +public: + int Retrieve(KXMLDOMElement pElement) + { + return GetKOffice()->Retrieve(pElement); + } + int Retrieve(KXMLDOMDocument& x) + { + return GetKOffice()->Retrieve(x); + } + int Retrieve(LPTSTR bstr) + { + return GetKOffice()->Retrieve(bstr); + } +public: + int DwUpdate(KXMLDOMElement pElement) + { + return GetKOffice()->DwUpdate(pElement); + } + int DwUpdate(KXMLDOMDocument& x) + { + return GetKOffice()->DwUpdate(x); + } +public: + Hxsoft::XFrame::xbObject* GetSheet(int nIndex) + { + return GetKOffice()->GetSheet(nIndex); + } + int GetSheetCount() + { + return GetKOffice()->GetSheetCount(); + } +public: + int SelectSheet(int nIndex) + { + return GetKOffice()->SelectSheet(nIndex); + } + int GetSelectedSheetIndex() + { + return GetKOffice()->GetSelectedSheetIndex(); + } + int RemoveSheet(int nIndex) + { + return GetKOffice()->RemoveSheet(nIndex); + } +public: + int GetData(KXMLDOMDocument px) + { + return GetKOffice()->GetData(px); + } + int GetData(KXMLDOMDocument px, int nIndex) + { + return GetKOffice()->GetData(px, nIndex); + } +public: + int SaveFileAs() + { + return GetKOffice()->SaveFileAs(); + } + int SaveFile() + { + return GetKOffice()->SaveFile(); + } + int SaveFile(xstring fileName) + { + return GetKOffice()->SaveFile((LPTSTR)fileName.c_str()); + } +public: + int OpenFile(xstring fileName) + { + return GetKOffice()->OpenFile((LPTSTR)fileName.c_str()); + } + int OpenFile() + { + return GetKOffice()->OpenFile(); + } +}; + + + -- Gitblit v1.9.3