Lost Formatting when copied to Word

M

Martyn Lawson

Hi,

I have a requirement to copy data from InfoPath to Word to be included in an
existing document. At first i didn't think this was possible as it wasn't
possible to highlight any text in InfoPath. Once i put the repeating tables
inside an optional section i was able to select it and copy.

Q1: Why does it have to be an optional section and not a normal section?

However, although all appears correct in the InfoPath view, when i paste
each individual table to Word, the formatting is different, ie: column widths
change.

I have tried copying the whole section and the same occurs. I have tried
using set column widths but to no avail.

Does anyone know why this is happening, or an alternative way to achieve
what i need?

Thanks in advance,
Martyn...
 
M

Martyn Lawson

Hi Franck,

Thanks for the response, that worked great. However, it is a lengthier
process than simply copying and pasting. Is there a way to automate the
export using rules or code. I am coding using JScript. I would want to
generate the file in a set location on the client machine with a set name
using a button press.

Thanks,
Martyn...
 
M

Martyn Lawson

Thanks again Franck.

I ahve searched this forum and found that the syntax
XDocument.View.Export("C:\Quote.mht","MHT"); should work. However, i am
getting a 'Permission Denied' error. Any ideas?

Also, on a similar note: I am trying to implement this by switching from the
current view to a new view then exporting and then switching back to the
original. However, when i attempt to switch back - the code generates an
error saying the 'view is not ready'. Any ideas?

Cheers in advance,
Martyn...
 
F

Franck Dauché

Hi Martyn,

Issue 1: Is your form fully trusted to access local resources?

Issue2: You need to look into the OnSwitchView event...

Regards,

Franck Dauché
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top