On 8/12/2009 2:43:56 AM, jxb wrote:
Does anyone know if there is a way of writing to a MCAD file from a MCAD file?
Further explanation: I have got a MCAD template with hidden calculations (the "intelligent" bit is not meant to be seen by the user) and a button to import data selected by the user (The user enters a reference number and the data is imported from a database). Once the data is imported successfully, the calculation is automatically carried out and the user gets a �OK� or �FAIL�. If it�s an �OK� then a text file containing the imported inputs and key outputs is automatically written.
Instead of writting this text file I would like to write the inputs to a MCAD document. Something like that:
Write this at the top of the MCAD file (repeat for all variables) (The numbers are for example and are imported form the database)
IN_Variable_A:=50
IN_Variable_B:=120
Calculation part: If one uses the MCAD document �as normal� then one writes �50� and �120� at the appropriate variables, the calculation bit is modified to read the new variables
Variable_A:= IN_Variable_A
Variable_B:= IN_Variable_B
If you use a version that support xmcd, then, yes, you can define some 'template' strings that hold the beginning and end parts of the Mathcad file (setting up the styles, etc, and closing xml statements) then have a further set of strings that create the desired regions.
I've done something similar. I created a template xmcd file, read it in, scan up until the 'regions' tag, generate and concatenate the new regions (you'll have to calculate the position in the new worksheet, but that should be straightforward), then scan the rest of the template xml string and write the whole thing to a new xmcd file.
Stuart