PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2018-8-1 14:06:14

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

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

x
Technique  ( k; ^9 M- A( G
On the client side use the vault control to write to a text file.
; i% T0 J, L3 j! O. d" T: U$ j* MJavaScript  
7 |1 _5 t0 H* T6 Uwith (top.aras.vault) 2 L% e5 v; s+ t. f0 R$ M+ G
{ ) I% |5 F9 k$ T0 H5 H# Y
  fileCreate(filePath);
1 L2 m3 S/ H% k/ ], f( _  fileOpenAppend(filePath); 8 l# M' y+ Q2 y( {+ h
  fileWriteLine('<AML><Item type="MyItemType"/></AML>'); 5 d& t/ Q& [) b1 e7 o
  fileClose(); 1 P; ]6 u- g. j) N7 C$ H; k
} : J0 {! R( t% E$ ~! V: ~2 ?( ?2 E
Technique  : M" n* }. f$ W" X; P# S
On the server side use the File and StreamWriter namespaces to write to a text file.
- h; x/ }  U2 H  U1 g8 G5 _C#  , p. J$ z' y" r0 G. ]2 l  P$ g9 W3 S
Innovator myInnovator = this.newInnovator(); : }) W/ ^, K' W$ |% _

' b: h- J5 N: f8 |$ S, ]$ g5 w// Save the results to a file.
/ ^. X0 c6 G, [8 A$ W5 Sstring path = myInnovator.MapPath("temp/yoyo.txt");
* }: Y3 [6 w8 Vtry 1 \2 q2 d) u! \- y9 @4 H
{
  `; H! e' r, F) E3 h  q/ i  M+ C  if (File.Exists(path)) File.Delete(path);   F8 V5 L& O4 A& G4 @  W# b. K! c" p: K
  StreamWriter sw = File.CreateText(path); # j" v2 s5 o( Z$ M! {0 L- j# H& _
  sw.Write(this.dom.InnerXml);
: Z/ A8 ?/ K8 b3 m" p" _- E) ~  sw.Close(); $ }# d' t5 T* }- S1 ]4 Y
} 5 p" w# D  T' x4 R* O5 u. s( ]
caTCh (Exception e)
. W0 A* T* W: K' A$ S{
: A7 a, |2 H# J% [: C  return myInnovator.newError(e.Message);   X' n% G4 @. l7 u
} , y6 `! G7 M& n
return myInnovator.newResult("ok"); . t  \% z7 D  f% ~
1 @+ N3 @( P: Y: u
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了