DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Create new sheets in report with script?

Is it possible to create new sheets in the report using VBscripts?
I am writing a script that will create a report with different sheets. The number of sheets in the report will change in each report depending on the number of groups added in the data portal. For example: If there are 3 channel groups in the data portal I will need 3 sheets in the report.
I searched for the instructions but I could not find how to do it.

And another question: how can I insert the name of a channel group in the report?

I am using DIAdem 9.0.

Thank you very much!
0 Kudos
Message 1 of 9
(6,932 Views)
Yes, its possible to create new REPORT sheets by VBScript. The command is GraphSheetNew. if you like to create a sheet for every group the script could look like:

For intCount = 1 to GroupCount ' Loop over all groups
GraphSheetNew(GroupName(intCount))
Next

To insert the name of a channel group you can drop the property name directly to REPORT. Another possibility is to create a text object with the text "@GroupPropGet(GroupIndexGet("NameOfTheGroup"),"name")@".

Stefan
0 Kudos
Message 2 of 9
(6,916 Views)
I´ve got an similar problem. But I use Diadem 8.1 academic. The term "GraphSheetNew" is unknown. How I can create new sheets in Diadem 8.1 academic?
0 Kudos
Message 3 of 9
(6,812 Views)

Johannes1,

I’m Sorry but on versions previous of DIAdem 9.0 this features are not available....

I think that you will have to create different LPD files or if is the same for your “groups” load each DATA file and update the LPD file…

0 Kudos
Message 4 of 9
(6,792 Views)

Hi Johannes,

This is not purely an API gap.  DIAdem 8.1 and previous versions only had one page in VIEW and REPORT at all times.  There was no way to add a "second" sheet either interactively or programmatically.  Multi-sheet REPORT and VIEW layouts was a new feature in DIAdem 9.0.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

 

0 Kudos
Message 5 of 9
(6,767 Views)

For all with the same problem: You can copy the Picture an paste it automaticaly in ms word.

Here my code:

Call PicPrint("WinClip") ' Copy picture to clipboard


'-----------------------------------------------------------------------------------
'open Word document

'-----------------------------------------------------------------------------------

' Start Word via OLE.
  ' Always a new instance of Word will be created.
  Set Word = CreateObject("Word.Application")

  ' Make Word visible. Until now Word was not visible.
  Word.Visible = True
  ' Maximize Word-window.
  Word.WindowState = wdWindowStateMaximize
' Create new Word-document based on prepared template.
   AutoDrvLibr="C:\......"    'direction of the Word ducument
   Const DiademWordTemplate = ".....doc"                                'ducument name
   Word.Documents.Add AutoDrvLibr & DiademWordTemplate, false
    ' Maximize document-window.

call copy_to_Word

'----------------------------------------------------------------------------------
Private Sub copy_to_Word

  Word.ActiveWindow.WindowState = wdWindowStateMaximize

  ' Activate fullpage mode in Word.
  Word.ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitFullPage

  ' Set reference to Word-document.
  ' With the help of this reference you can easily acess the Word-document.
  Set WordDoc = Word.ActiveDocument
Const wdPasteMetafilePicture = &H3

'Paste picture
  Word.Selection.Range.PasteSpecial , , , , wdPasteMetafilePicture
  Word.Selection.EndKey 5                 'Set Courser to end of page
  Word.Selection.Range.InsertBreak(&H1)   'paste new sheet
  Word.Selection.MoveDown 5,1             'move ohne row down to set the courser to the next page
end sub

0 Kudos
Message 6 of 9
(6,755 Views)

Hello every one,

 

Is it possible to insert the name of the sheet in the sheet of the Report?

 

All the best,

 

Louval

0 Kudos
Message 7 of 9
(5,560 Views)

Hi Louval,

 

which DIAdem Version do you use. Since DIAdem 1012 it is very easy to add the name of the sheet. Use the equation @@report.ActiveSheet.Name@@ in a text to display the name of the sheet.

 

Stefan

 

 

0 Kudos
Message 8 of 9
(5,548 Views)

HI,

 

I have to create a script that will generate a report following a defined template. The report contains tables having a number of lines that will vary depending on the input data. Sometime, a graph have to be added before or after a table. I does Diadem manages the creation of the sheets?

 

  1. Do I need to define the height of a line and then establsih that after n line I create a new sheet with an 2DTable that starts from index n?
  2. Is there a way to tell Diadem to create a new sheet to fit the rest of the table with a graph tha the size is known?

In simple word, can Diadem behave like MS Word or like OpenOffice Write ( they add new pages when required) or do have have to manually program this behavior?

 

By the way, the important requirement is to have the pdf exported file that shows on multiple pages all the data of a 2DTable and the graph after this table. It is not mandatory to have all the sheets in the active Layout.

0 Kudos
Message 9 of 9
(5,430 Views)