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

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

[复制链接]

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

admin 发表于 2018-8-1 14:06:14 |阅读模式

admin 楼主

2018-8-1 14:06:14

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

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

x
Technique  ' ]' ]/ A  K$ h8 S* o. N
On the client side use the vault control to write to a text file. / b; V4 ^: X) j% s/ k' C
JavaScript  
) `1 N  x$ p& |- d$ {with (top.aras.vault) 9 w3 x# l5 Q) F7 Z2 Z. |- w
{
+ h  Y' [' G% T! e0 }  fileCreate(filePath);
0 E' s, D: e4 \+ L( l  fileOpenAppend(filePath); 8 i% i7 k: \& i
  fileWriteLine('<AML><Item type="MyItemType"/></AML>');
/ c6 {: V3 E! Z! t" L6 J% \  fileClose(); 2 o2 I. e- |3 i6 y" P5 y
}
" v/ U0 G/ v9 l# gTechnique  
9 z7 B4 F+ U7 F3 cOn the server side use the File and StreamWriter namespaces to write to a text file.
7 j8 |: X5 c$ V7 L3 e* N; U. AC#  : D4 w1 p0 v8 H7 r
Innovator myInnovator = this.newInnovator();
4 Y6 v, d6 R8 Z: D3 U( O0 _# T
" p3 Z" s3 y- z) N1 v1 _// Save the results to a file.
4 B: Y6 |1 r) Q5 M8 F( J2 f, nstring path = myInnovator.MapPath("temp/yoyo.txt"); , k' ^( ]. U6 `, i9 Z2 ^
try . Z' |6 L* X) L  e- w
{ + Z8 y) b' ^1 h1 g$ ~6 W8 K$ S/ m
  if (File.Exists(path)) File.Delete(path); , R* ?; W0 f0 a4 x% S
  StreamWriter sw = File.CreateText(path);
( l6 N7 t$ u6 w* V. f2 u+ ?  sw.Write(this.dom.InnerXml); / L( l( f* g. T
  sw.Close(); 8 I. W+ V: N- D3 ~3 A! e0 j
}
# H3 L2 |1 a4 e- P& FcaTCh (Exception e)
( @- d: p& _) t3 R9 T5 e{ 3 {. L# q. W1 j, _2 a
  return myInnovator.newError(e.Message);
+ x% m& p+ T6 T# E5 G( S}
4 T5 ~) n! A5 c0 ^/ }6 i  E- z9 Vreturn myInnovator.newResult("ok");
8 m1 {" q. S7 B+ V2 _6 ^2 D- u! J* g! J# b
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了