Jump to content

Generating Multiple Pdf based on the distinct values from Data Table


Arpit Trivedi

Recommended Posts

Hi Team , I am working on to genearate dynamicmultiple pdf's based on the values in Data Table.I tried generating via prepared report but it gives a single pdf with all records. I want dynamic pdfs with different name for each data set.

Issue : getting multiple pdfs but all pdf having the same data . I expect data to changeas i am changing the Data limit condition . This happens mostly in case of multiple records.

Mostly getting all teh pdfs for the last value in the list.

#Companies is list of all the unique companies names

for company in Companies:

try:

print company

refreshData(company,filelocation)

except:

pass

 

# Declaring the function which will run async

def g(app,fileName):

def f():

app.ExportToPdf(fileName)

return f

def refreshData(company,filelocation):

page=Document.ActivePageReference

page.Title=company

for vis in page.Visuals:

print vis.Title

if vis.Title != 'skip':

myVis = vis.As[CrossTablePlot]()

WhereClauseexp="[companyname]='#val'"

print re.sub('#val',company, WhereClauseexp)

myVis.Data.WhereClauseExpression =re.sub('#val',company, WhereClauseexp)

report = Application.Document.TryGetReport("PreparedReport")[1]

name=re.sub('[^a-zA-Z0-9 n]', '', company)

filename=filelocation+name+".pdf"

print filename

 

t=Application.GetService[ApplicationThread]()

print t

t.InvokeAsynchronously(g(report,filename))

return true

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...