PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2018-8-1 14:06:14

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

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

x
Technique  # a) C/ Y' m3 H) F# s8 Y# \/ e
On the client side use the vault control to write to a text file.
+ |5 b. `0 ~! i- ~# dJavaScript  : [5 L* p, z/ v) m: c$ A" j
with (top.aras.vault)
6 B  k/ X; j  L; V{ ; o1 k4 K, e: _. C. F0 |1 k
  fileCreate(filePath);
; o3 K2 {! e0 U& J' v  fileOpenAppend(filePath);
- Q$ w+ g0 ?$ U1 Y  fileWriteLine('<AML><Item type="MyItemType"/></AML>');
& \) p# g- a& e( {' ?: g  s2 \2 y  fileClose();
! o9 P  z2 `! Z+ X: k} & z# c1 t7 z2 ^- D: W+ O& n( r3 \
Technique  
; z3 M6 b- Z' u+ P  o1 P  r8 FOn the server side use the File and StreamWriter namespaces to write to a text file.
, j& F& g* ^- ^7 E( t$ |C#  
& I  V2 D' s2 y7 j6 b: F) |& ]Innovator myInnovator = this.newInnovator();
& C0 {3 s* g4 W) \, m  ?8 ~ ' |" a5 C. ?2 {, q+ B2 X, {, M& }$ A
// Save the results to a file. + `; r. W( s" J7 Y* G$ \
string path = myInnovator.MapPath("temp/yoyo.txt"); $ {6 `( y4 a; Y4 o8 Y1 z% t
try
+ J( f3 i2 z+ e7 J0 L{ 1 j5 x1 m! o' n4 {
  if (File.Exists(path)) File.Delete(path); & \% L' v: |4 f. o, ^) E1 y
  StreamWriter sw = File.CreateText(path); 8 ^0 h7 O1 O8 g( L! T. b$ H5 A# t
  sw.Write(this.dom.InnerXml); 3 n: W! [$ T3 O/ h" V
  sw.Close();   C: b! x5 I6 K8 q
} - v; t1 R0 c9 p, ]
caTCh (Exception e) ) C& ]. ~- c2 B8 k9 g! [8 c
{ ( L2 V* U8 p6 m/ `
  return myInnovator.newError(e.Message); + ^" D; s3 U9 c) m) U7 L
} - w) [0 o, s' T) Y: w
return myInnovator.newResult("ok");
4 I7 ?" q( V! d* Y0 z& h& U2 l% K2 i# Q- d4 ^" i$ m5 `
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了