1 Star 0 Fork 7

caizongchao/Help

forked from HCView/Help 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
HCEmrViewSample.保存文件.html 13.43 KB
一键复制 编辑 原始数据 按行查看 历史
HCView 提交于 2019-07-11 17:07 . 完善一些内容
<!DOCTYPE html>
<html>
<head>
<title>THCView.DoSectionDrawItemPaintAfter(THCCustomData,Integer,TRect,Integer,Integer,Integer,Integer,TCanvas,TPaintInfo) Method</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="Documentation Insight" />
<base target="_self" />
<link type="text/css" rel="Stylesheet" href="css/presentation.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/di.js"></script>
<style type="text/css">
.tabHead {
float: left;
padding-left: 2px;
}
.active {
background-color: #f8f8f8;
}
.disActive {
background-color: #939393;
border-bottom: solid 1px #939393;
}
.tabHead :hover {
background-color: bisque;
cursor: pointer;
}
.unActive {
display: none;
}
</style>
<script type="text/javascript" src="js/jquery-migrate.min.js"></script>
<!--[if (!IE) | (gt IE 8)]><!-->
<link type='text/css' rel='Stylesheet' href='css/highlighter.css' />
<!--<![endif]-->
<!--[if (!IE) | (gt IE 8)]><!-->
<script src="js/highlight.min.js"></script>
<!--<![endif]-->
<script type="text/javascript">
if (($.browser.msie == undefined) || ($.browser.version > 8)) {
hljs.tabReplace = ' ';
$(document).ready(function() {
$("#footerContent").html(getCopyright());
$('pre').each(function(i, e) {
hljs.highlightBlock(e);
});
});
}
</script>
<script type="text/javascript">
if (top.frames.length == 0) {
var topicUrl = top.location.href.substring(top.location.href.lastIndexOf("/") + 1, top.location.href.length);
var regex = new RegExp('(mk:@MSITStore|ms-help):?', 'i')
if (!top.location.href.match(regex)) {
top.location.href = "index.htm?" + topicUrl;
}
} else if (top && top.navigationFrame && top.navigationFrame.selectTocItem) {
top.navigationFrame.selectTocItem("HCView.THCView.DoSectionDrawItemPaintAfter(THCCustomData,Integer,TRect,Integer,Integer,Integer,Integer,TCanvas,TPaintInfo)");
};
</script>
<script type="text/javascript">
var tempId = "Delphi";
$(document).ready(function() {
$(".codeSnippetTabActive").on("click", function() {
var obj = $(this);
var id = obj.attr("data-lbl");
$(".codeSnippetTabActive").removeClass("active");
$(".codeSnippetTabActive").addClass("disActive");
obj.removeClass("disActive");
obj.addClass("active");
$("#" + tempId).addClass("unActive");
$("#" + id).removeClass("unActive");
tempId = id;
});
});
</script>
</head>
<body class="library">
<input type="hidden" id="contentEditableControl" class="userDataStyle" value="false" />
<input type="hidden" id="userDataCache" class="userDataStyle" />
<input type="hidden" id="hiddenScrollOffset" />
<input type="hidden" id="moduleName" value="HCEmrView" />
<input type="hidden" id="elementId" value="HCView.THCView.DoSectionDrawItemPaintAfter(THCCustomData,Integer,TRect,Integer,Integer,Integer,Integer,TCanvas,TPaintInfo)" />
<div id="content">
<div class="topic">
<h2 class="title">保存文件</h2>
<h3>保存文件分为2种,一种是磁盘文件,另一种是二进制流文件,前者适合导出文件以便拷贝共享或二次导入,后者适合拿到流后写到数据库或通过网络发送。2种保存方法均未对生成的文件或流进行压缩,你可以需要时自行压缩。</h3>
<div id="mainSection">
<div id="mainBody">
<div id="summarySection" class="section">
<input class="tagName" type="hidden" value="summary" />
<div id="summaryHeader" class="sectionHeader">
<div>
<a href="javascript:void(0)" class="collapsibleAreaHref" title="Collapse">
<span class="collapsibleAreaIcon collapsibleAreaExpanding">
<!---->
</span>
<span class="collapsibleAreaTitle">Summary</span>
</a>
</div>
</div>
</div><br />
<div id="syntaxSection" class="section">
<div id="syntaxHeader" class="sectionHeader">
<div>
<a href="javascript:void(0)" class="collapsibleAreaHref" title="Collapse">
<span class="collapsibleAreaIcon collapsibleAreaExpanding">
<!---->
</span>
<span class="collapsibleAreaTitle">参考</span>
</a>
</div>
</div>
<div id="syntaxContent" class="sectionContent" contentEditable="false">
<div class="codeSnippet" contentEditable="false"><input class="code" type="hidden" value="" />
<div class="codeSnippetTabs tabHead">
<div class="codeSnippetTabActive active" data-lbl="Delphi"><a>Delphi</a></div>
</div>
<div class="codeSnippetTabs tabHead">
<div class="codeSnippetTabActive disActive" data-lbl="CSharp"><a>C#</a></div>
</div>
<div class="codeSnippetCodeContainer tabs" id="Delphi">
<div class="codeSnippetCode">
<h4 class="subHeading">保存为流并提交数据库</h4>
<dl>
<pre class="delphi" contentEditable="false">
procedure TfrmTemplate.DoSaveTempContent(Sender: TObject);
var
vSM: TMemoryStream;
vTempID: Integer;
begin
vSM := TMemoryStream.Create;
try
(Sender as TfrmRecord).EmrView.SaveToStream(vSM);
vTempID := TTemplateInfo((Sender as TfrmRecord).ObjectData).ID;
BLLServerExec(
procedure(const ABLLServerReady: TBLLServerProxy) // 获取患者
begin
ABLLServerReady.Cmd := BLL_SAVETEMPLATECONTENT; // 获取模板分组列表
ABLLServerReady.ExecParam.I['tid'] := vTempID;
ABLLServerReady.ExecParam.ForcePathObject('content').LoadBinaryFromStream(vSM);
end,
procedure(const ABLLServer: TBLLServerProxy; const AMemTable: TFDMemTable = nil)
begin
if ABLLServer.MethodRunOk then // 服务端方法返回执行成功
begin
(Sender as TfrmRecord).EmrView.IsChanged := False; // 保存后文档标识为非修改
ShowMessage('保存成功!');
end
else
ShowMessage(ABLLServer.MethodError);
end);
finally
FreeAndNil(vSM);
end;
end;
</pre>
</dl>
<h4 class="subHeading">保存为文件,支持.hcf、xml、docx</h4>
<dl>
<pre class="delphi" contentEditable="false">
procedure TfrmRecord.mniSaveAsClick(Sender: TObject);
var
vSaveDlg: TSaveDialog;
vExt: string;
begin
vSaveDlg := TSaveDialog.Create(nil);
try
vSaveDlg.Filter := '文件|*' + HC_EXT + '|HCView xml|*.xml|Word 2007 Document (*.docx)|*.docx';
if vSaveDlg.Execute then
begin
if vSaveDlg.FileName <> '' then
begin
vExt := '';
case vSaveDlg.FilterIndex of
1: vExt := HC_EXT;
2: vExt := '.xml';
3: vExt := '.docx';
else
Exit;
end;
if ExtractFileExt(vSaveDlg.FileName) <> vExt then // 避免重复后缀
vSaveDlg.FileName := vSaveDlg.FileName + vExt;
case vSaveDlg.FilterIndex of
1: FEmrView.SaveToFile(vSaveDlg.FileName); // .hcf
2: FEmrView.SaveToXML(vSaveDlg.FileName, TEncoding.UTF8); // xml
3: FEmrView.SaveToDocumentFile(vSaveDlg.FileName, vExt)
end;
end;
end;
finally
FreeAndNil(vSaveDlg);
end;
end;
</pre>
</dl>
</div>
</div>
<div class="codeSnippetCodeContainer tabs unActive" id="CSharp">
<div class="codeSnippetCode">
<h4 class="subHeading">保存为流并提交数据库</h4>
<dl>
<pre class="CSharp" contentEditable="false">
private void DoSaveTempContent(object sender, EventArgs e)
{
using (MemoryStream vSM = new MemoryStream())
{
(sender as frmRecord).EmrView.SaveToStream(vSM); // 得到文档数据流
int vTempID = ((sender as frmRecord).ObjectData as TemplateInfo).ID;
EMRView.emrMSDB.ExecCommandEventHanler vEvent = delegate(SqlCommand sqlComm)
{
sqlComm.Parameters.AddWithValue("tid", vTempID);
sqlComm.Parameters.AddWithValue("content", vSM.GetBuffer());
};
if (emrMSDB.DB.ExecSql(emrMSDB.Sql_SaveTemplateConent, vEvent))
{
(sender as frmRecord).EmrView.IsChanged = false; // 保存后文档标识为非修改
MessageBox.Show("保存成功!");
}
else
MessageBox.Show(emrMSDB.DB.ErrMsg);
}
}
</pre>
</dl>
<h4 class="subHeading">保存为文件,支持.hcf、xml</h4>
<dl>
<pre class="CSharp" contentEditable="false">
private void mniSaveAs_Click(object sender, EventArgs e)
{
SaveFileDialog vDlg = new SaveFileDialog();
vDlg.Filter = "文件|*" + HC.View.HC.HC_EXT + "|HCView xml|*.xml";
if (vDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (vDlg.FileName != "")
{
string vExt = "";
switch (vDlg.FilterIndex)
{
case 1:
vExt = HC.View.HC.HC_EXT;
break;
case 2:
vExt = ".xml";
break;
default:
return;
}
if (System.IO.Path.GetExtension(vDlg.FileName) != vExt)
vDlg.FileName = vDlg.FileName + vExt;
switch (vDlg.FilterIndex)
{
case 1:
FEmrView.SaveToFile(vDlg.FileName);
break;
case 2:
FEmrView.SaveToXml(vDlg.FileName, Encoding.UTF8);
break;
}
}
}
}
</pre>
</dl>
</div>
</div>
</div>
</div>
</div>
<div id="seealsoSection" class="section">
<input class="tagName" type="hidden" value="seealso" />
<div id="seealsoHeader" class="sectionHeader">
<div>
<a href="javascript:void(0)" class="collapsibleAreaHref" title="Collapse">
<span class="collapsibleAreaIcon collapsibleAreaExpanding">
<!---->
</span>
<span class="collapsibleAreaTitle">查看</span>
</a>
</div>
</div>
<div id="seealsoContent" class="sectionContent" contentEditable="false">
<ul class="seeAlsoCodeReference">
<li><a href="HCEmrView_Property.htm" title="HCEmrView属性">HCEmrView属性</a></li>
<li><a href="HCEmrView_Method.htm" title="HCEmrView方法">HCEmrView方法</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="footerContent"></div>
</div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/caizongchao/Help.git
git@gitee.com:caizongchao/Help.git
caizongchao
Help
Help
master

搜索帮助