PLM之家PLMHome-工业软件践行者

【Aras二次开发源码】如何将文本存成文件

[复制链接]

2018-8-1 14:06:14 2334 0

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82162
QQ
发表于 2018-8-1 14:06:14 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
Technique  
0 L* o2 b( D" V# A& `On the client side use the vault control to write to a text file.
4 H" N& w- j* YJavaScript  ) j" C( L# M$ b
with (top.aras.vault) 1 S7 _8 ]* N1 Q* M
{
3 J2 g* n- ^4 X. O9 S+ \* P  fileCreate(filePath); 9 O! @. _; |- l, Y/ W9 [( U
  fileOpenAppend(filePath);
9 Z& b/ B4 X! }  fileWriteLine('<AML><Item type="MyItemType"/></AML>');
( |% l5 l0 _9 X  fileClose(); 0 V4 Z8 g: z2 K* |! v
} / r, Q6 X. N) E, m6 n5 R9 {8 j+ o
Technique  
, h; {& {: ?  FOn the server side use the File and StreamWriter namespaces to write to a text file. " D6 V/ S, |7 d
C#  ! Y' l; Z6 n/ C5 x
Innovator myInnovator = this.newInnovator(); - z  \# ~/ b" Y  f, |$ L/ Y( T

' _) X* M; q9 }$ Z/ f; F# p$ ?// Save the results to a file.
$ f! z# p) N. p% Z5 V! @0 j5 qstring path = myInnovator.MapPath("temp/yoyo.txt"); & g6 L" ^8 Z; l4 t
try 6 H3 G3 D0 A1 F# d# g
{ 3 x, N" b( H; F3 [
  if (File.Exists(path)) File.Delete(path);
- s/ T7 W+ y9 g! q( H' _  StreamWriter sw = File.CreateText(path); & {% b! ?9 P' y+ b4 p1 p
  sw.Write(this.dom.InnerXml);
" l# D) X# s% q* b  sw.Close(); . f6 P5 y$ z! R2 ]7 u5 O9 h7 r
}
+ @& Z# d8 {0 l4 S9 w: ScaTCh (Exception e) * Z- V, e; N" S. G
{ - i+ P7 d5 t* f; ~0 D* m: ]
  return myInnovator.newError(e.Message); 2 W/ U6 s$ G7 y, V7 {, d. m
} 7 D' g% b1 u) w/ B
return myInnovator.newResult("ok"); ! V! x4 i+ n5 c6 G2 H3 F  q

2 ?  L4 P7 q0 T' @, R1 l/ x
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了