Jump to content

OnJobEnd do a macro and print the result of Macro


Recommended Posts

Hi,

Is it possible that when Job end, fusion pro take a macro on a excel data and restart to print variable date the result of a macro .

 

I attach the macro that i have on a excel and that write on sheet 2.

 

Now i create a file for fusion pro for print variable data and after i create another file from sheet 2 for print the variable data from result to macro.

 

Sub Estrai()

Dim Coll As New Collection

Dim uRiga As Long

Dim Righe As String

Dim Matrix As Variant

Dim Arr

Dim i As Integer

Dim y As Integer

 

 

'determina l'ultima riga

uRiga = Foglio1.Range("A" & Rows.Count).End(xlUp).Row

 

 

'carica la tabella in matrice

Matrix = Foglio1.Range("A1:L" & uRiga)

 

 

'esculde i duplicati

On Error Resume Next

For i = 2 To uRiga

Coll.Add i, CStr(Foglio1.Cells(i, 12) & Foglio1.Cells(i, 1) & Foglio1.Cells(i, 2))

Next

On Error GoTo 0

 

 

'genera matrice con le righe univoche

For i = 1 To Coll.Count

Righe = Righe & " " & Coll(i)

Next

Righe = Trim(Righe)

 

 

'estrae dalla matrice principale una matrice filtrata senza duplicati

Arr = Application.Index(Matrix, Application.Transpose(Split(Righe)), Array(12, 1, 2, 10))

 

 

'azzera il 4^ campo della matrice

For i = 1 To UBound(Arr)

Arr(i, 4) = 0

Next

 

 

'somma nel 1^ campo della matrice ogni dato univoco

For i = 1 To UBound(Arr)

For y = 1 To UBound(Matrix)

If Arr(i, 1) = Matrix(y, 12) And Arr(i, 2) = Matrix(y, 1) And Arr(i, 3) = Matrix(y, 2) Then

Arr(i, 4) = Arr(i, 4) + Matrix(y, 10)

End If

Next y

Next i

 

 

'scrive le intestazioni

Foglio2.Range("A1") = "Ciao"

Foglio2.Range("B1") = "come"

Foglio2.Range("C1") = "stai"

Foglio2.Range("D1") = "ok"

 

 

'scrive la matrice su foglio

Foglio2.Range("A2").Resize(UBound(Arr), 4) = Arr

 

 

End Sub

 

 

Thank you

Link to comment
Share on other sites

Hi,

Is it possible that when Job end, fusion pro take a macro on a excel data and restart to print variable date the result of a macro .

No. At least not with FusionPro VDP Creator, which is just an Acrobat plug-in. That FusionPro plug-in doesn't have the ability to control any other processes.

 

Typically a use case like this is accomplished with FusionPro Server, where there's another application (usually a web application of some kind, such as MarcomCentral) which drives the entire workflow and invokes FusionPro for the composition as part of the workflow.

 

I don't completely understand exactly what you're trying to do in that macro (non parlo italiano), but

 

I'm envisioning an application, possibly even a macro in Excel, that performs these steps:

  1. Exports data for the FusionPro composition.
  2. Invokes FusionPro Server (either via a command line or with our Web Service API) for composition.
  3. Waits for the composition to finish.
  4. Parses the XML log file to:
    • (a) validate whether the job ran correctly and met whatever business requirements you have and
    • (b) capture any custom result code written to the XML log via a FusionPro JavaScript rule.

[*]Updates your database (or your poor man's version of a database in Excel).

[*]Possibly runs another composition and repeats the above steps.

 

I should also note that, with either FusionPro VDP Creator or Server, you can access multiple sheets from an Excel workbook as external data files, but I don't think that helps in this particular case.

Link to comment
Share on other sites

after compose the pdf add on job end is possible to restart read file excel from first record and compose ather file below first composition??

No, not with Creator.

 

But what would that get you other than a duplicate of the first output file? What are you really trying to do?

Link to comment
Share on other sites

You could do something like this in Creator, in OnRecordStart, with your main input type set to None:

var outputRepeatCount = 2; // total number of output files
var mainData = new ExternalDataFileEx("YourDataFileName.xlsx", "Excel");
FusionPro.Composition.repeatRecordCount = mainData.recordCount * outputRepeatCount;

var XDF_rec = (FusionPro.Composition.repeatRecordNumber - 1) % mainData.recordCount + 1;
if (XDF_rec == 1)
   FusionPro.Composition.OpenNewOutputFile();

FusionPro.Composition.AddVariable("inputRecordNumber", XDF_rec);
for (var i = 0; i < mainData.fieldCount; i++)
   FusionPro.Composition.AddVariable(mainData.GetFieldValue(0, i), mainData.GetFieldValue(XDF_rec, i));

return mainData.recordCount;

With no other changes, that will give you two exact copies of the same output file. But I'm still not sure how close that is to what you ultimately want.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...