Free Support Forum - aspose.com

AutoFiller.UnFlattenFields

Hi Ken,

I’ve been playing around with this new property, and I can’t get textfields to “unflatten”. Checkboxes will unflatten properly but I haven’t tested others.

I’m basically doing:

AutoFiller.UnFlattenFields = Form.FieldsNames

That should “unflatten” all the fields?

Thanks, Natan.

Dear cohenn,

I have tested this property completely and it is ok.
So, could you send me your pdf and code in the attachment?

Best regards.

Hi Ken,

I’ve attached my project. Toggle flattening fields in the output PDF by setting the following attribute in “Form_941.lgx”:

FlattenFields = “True” or “False”

The output is written to the “rdDownload” folder. If you set breakpoints in the subCreateMergedPdf( ) function within rdPdfForm.vb, you’ll see how I’m using this property. The output is always the same, though, with all textfields flattened and some checkbox fields unflattened.

Thanks, Natan.

Dear cohenn,

I have read your code and found the problem in the "subCreateMergedPdf( ) ".
All the properties should be set before AutoFiller.ImportDataTable(), including the “UnFlattenFields”.

So the code in "subCreateMergedPdf( ) " should be changed like the following:



If Not IsNothing(mUnFlattenedFields)
Then pdfAutoFiller.UnFlattenFields =
mUnFlattenedFields.ToArray(Type.GetType(“System.String”))
pdfAutoFiller.ImportDataTable(dtFormData)
pdfAutoFiller.Save()


Please change your code and test it.
Sorry for having not explained it in the help doc.

Best regards.

Hi Ken,

Switching those two lines of code worked, however only text fields are being flattened. The first checkbox in the “Report for this quarter” is flattened, however you can still select the other three. All other checkboxes are not flattened. You can see this behavior in the project I attached to this thread.

Also, this particular input is actually 3 Form 941’s. I noticed that editing a textfield in the first form makes the changes for the other two as well. Can users edit each form’s fields separately when AutoFiller unflattens fields?

Thanks, Natan.

Dear cohenn,

1) I have tested that flattening all the checkboxs is ok in my program.
2) Because I can’t open your asp.net project correctly, I counldn’t track the varible value, I think maybe your “mUnFlattenedFields” varible has included the field name of the checkBox “c1-1” which should not be included since you want to flatten it. Please check it. If all is right, please attach a simpler example without asp.net project.
3) If the fields’ name is not the same, the fields’ value will not be changed at the same time, Please check this.

Best regards.

Ken,

Thanks for your help. It’s actually not possible for “mUnFlattenedFields” to include “c1-1” since the following line of code is executed when all fields are flattened:

If bFlattenFields Then mUnFlattenFields = Nothing

I will try to create a version of this project that does not require an HttpContext.

Thanks, Natan.