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

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

[复制链接]

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

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

admin 楼主

2018-8-1 14:06:14

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

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

x
Technique  
" J. Q8 w8 @4 x; VOn the client side use the vault control to write to a text file. $ e& P( D, o5 A; S
JavaScript  / d+ }3 Y9 ~* E- y8 x% I) F! N
with (top.aras.vault) * g- i. K+ n, I6 S+ V( X
{
' H6 \; o; K% W8 {  fileCreate(filePath);
+ y9 v! Y  _# |$ g  fileOpenAppend(filePath);
0 {% O* T3 ^6 r  fileWriteLine('<AML><Item type="MyItemType"/></AML>');
+ Q1 w$ l6 `# f# o2 L. q' M9 K; \  fileClose();
4 c5 L( E1 g- ?: ^. h} ; `/ X- J+ g8 H3 L3 U$ u
Technique  
) j/ q% g  G  @' c7 `& a6 pOn the server side use the File and StreamWriter namespaces to write to a text file. . d1 w: d" x, O7 I
C#  
% o; W% x* A- n) R: C, ZInnovator myInnovator = this.newInnovator();
% g& ]! R, Z( ]0 k 3 ^9 K, |, e9 t
// Save the results to a file.
$ m+ ^; d0 T: g) E0 Istring path = myInnovator.MapPath("temp/yoyo.txt");
. `/ b5 |* l6 B+ K9 Htry + U. o# P7 t- F/ @6 V5 `+ @
{ / g9 n  p: d! a- a
  if (File.Exists(path)) File.Delete(path);
: d$ q$ G0 y# s, _" \0 z3 N  StreamWriter sw = File.CreateText(path);
6 v# I3 h4 k; Y$ m/ O( _. `  sw.Write(this.dom.InnerXml);
8 f2 `( n  S3 q; j# H& b  sw.Close(); 9 V) V! k* p' J8 g6 v& H; c
}
" i$ `8 K' a& ^/ M% m8 i$ M! l& KcaTCh (Exception e)
1 i" Z. i  P2 M5 w{ 7 k- K! u1 z- V. k6 D
  return myInnovator.newError(e.Message); & ?; E0 @6 @, L4 H8 N
} & h( b. }6 }; I- e" V! j7 z: n
return myInnovator.newResult("ok");
$ c" P: {. O* r0 G
  n/ T6 C- u% k- b0 G
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了