i have bunch of existing rtf tables , add them .docx file when using r package "reporters". dose not support external rtf table yet. trying insert file path .docx file , toggle link table. that, need add pair of braces "{}" around file path. adding symbol "{}" around file path not work since braces translated rtf codes in word , background rtf code "{}" quite complicated. now, questions are:
(1) how add resolvable braces "{}" around rtf file path can toggle link. tried use rtf code found replace braces, can not complied braces microsoft word. rtf code found this:
{\field{*\fldinst {\rtlch\fcs1 \af31503 \ltrch\fcs0 \insrsid8593807 \hich\af31502\dbch\af31501\loch\f31502 \hich\af31502\dbch\af31501\loch\f31502 includetext "\\\\ file pth\d0blchar.rtf" \c msrtf\hich\af31502\dbch\af31501\loch\f31502 }}
i hope can resolved word like: {includetext "\\ file pth\d0blchar.rtf" \c msrtf }
but seems me word can not compiling.
(2) if (1) not workable, there other r package can include rtf tables word file when creating word file r?
my sample code attached:
library(reporters) path<-'\\\\\\\\mypath\\data\\table1.rtf' #path related tlfs report<-docx() #initialize docx object text1<-"{\\field{\\*\\fldinst {\\rtlch\\fcs1 \\af31503 \\ltrch\\fcs0 \\insrsid8593807 \\hich\\af31502\\dbch\\af31501\\loch\\f31502 \\hich\\af31502\\dbch\\af31501\\loch\\f31502 " text2<-"\\hich\\af31502\\dbch\\af31501\\loch\\f31502 }}" fileadd<-paste0(text1,"includetext \"", path, "\" \\c msrtf", text2) report<-addparagraph(report,fileadd) #add rtf tables writedoc(report, file="report.docx") #output docx file
============================================
thanks lot!
Comments
Post a Comment