07-08-2020 08:36 AM
Hello,
I need to arrange some object in DIADEM report page with script. Firstly, I have to use "arrangement" feature.
(Right click on object -> arrangement -> Move to Background)
Possible to do this with script? I could not take this script with "record script" or "copy as script"
Secondly, when I add some .png file as object, DIADEM takes it as a rectangle. It causes some problems when I export it as .PDF because they overlap each others. Is it possible to take a .png file like really .png?
Thank you.
07-08-2020 09:39 AM
Hi mmt1357,
You can move any object to background from VBScript with MoveToBackground method of ZOrder object.
Method: MoveToBackground for ZOrder - DIAdem 2018 Help - National Instruments
http://zone.ni.com/reference/en-XX/help/370858P-01/reportapi/methods/report_method_movetobackground_...
If you run the following example, which is also in the help section, you should be able to understand how it works.
Dim oMyCircle, oMyFrame
Call Report.NewLayout()
Set oMyCircle = Report.ActiveSheet.Objects.Add(eReportObjectCircle,"MyCircle")
Call oMyCircle.BackgroundColor.SetPredefinedColor(ePredefinedColorBlue)
Set oMyFrame = Report.ActiveSheet.Objects.Add(eReportObjectFrame,"MyFrame")
Call oMyFrame.BackgroundColor.SetPredefinedColor(ePredefinedColorRed)
Call oMyFrame.Position.ZOrder.MoveToBackground()
Call Report.Refresh()
As for your question about png file, I don't understand what the problem is.
My understanding is that perhaps when you line up png files with a transparent background, they should not overlap, but they do because the rectangle is no longer transparent in DIAdem. Is my understanding correct?
I checked with DIAdem2020, but I'm able to export to PDF without any overlap of pngs as shown in the following figs and attached PDF.
Could you check the settings of background color for the image object?
Or, if you have any files to reproduce, it would help me to understand
Thanks,
Yoshiaki
07-09-2020 02:03 AM
Hi Yoshiaki,
The method you shared with me solved my first problem. Thank you.
The second problem is exactly like you understand. However, when I open your .pdf file, I see it like below. Overlaping is continue.
I am using this code.
Set oMyImage = Report.ActiveSheet.Objects.Add(eReportObjectImage, "MyPngObject")
Set oMyPos = oMyImage.Position.ByCoordinate
oMyImage.UseOriginalRatio = True
oMyPos.X1 = ....
oMyPos.Y1 = ....
Call oMyImage.Position.ZOrder.MoveToForeground (I updated this line after your feedback)
Call oMyImage.BackgroundColor.SetPredefinedColor(eColorIndexNone)
As I understand, last line should be updated. Is it possible to make transparent background? Even if the backgorund is seen transparent in DIADEM report page, after exporting to .PDF, it does not stay at like DIADEM report page.
Have a nice day.
Mehmet
07-09-2020 11:17 AM
Hi Mehmet,
Thank you for updating your situation.
Here's a screenshot of NONAME.pdf opened in google chrome in my environment.
As you can see, there is no overlap.
And I found that they certainly overlap if I just use another PDF viewer, e.g. MS Edge, to open the same NONAME.pdf as follows:
It's interesting 😞
I am not sure, but I wonder if it's a problem with the Amyuni PDF printer that DIAdem is using.
By the way, if I use Microsoft PDF printer, not Amyuni, to export PDF file, the overlap is no longer occurring even though the PDF files opens in MS Edge.
Variable: PDFUseMicrosoftPrinter - DIAdem 2018 Help - National Instruments
http://zone.ni.com/reference/en-XX/help/370858P-01/varoff/pdfusemicrosoftprinter/
Can this be a workaround for you?
Best regards,
Yoshiaki
07-14-2020 02:06 AM
Thank you Y. Sato.
I could not solve my .PDF problem but I will try some other solutions.
Have a good day.