开发者

Any way to add paste multiple row data into an InfoPath repeating table?

My users use Excel to come up with some ad-hoc lists of buildings we own. I'm building an InfoPath form to manage contracts on those buildings. I'm looking for a way to let my users specify the buildings they need in Excel, and paste that list into the InfoPath form Repeating Table control.

The table has multiple fields; the users would select the Building ID column in their spreadsheet, paste it into the Building ID field in the Repeating Table, and then the InfoPath form would look up the remaining building info from the datasource bound to the control, using the Building ID as the key.

The Repeating Table lookup part is currently working: the user ca开发者_运维问答n enter (by typing or pasting from Excel) a single Building ID, hit Tab, and the table looks up the rest of the info. Then they can insert a new row, and enter the second building ID, lather, rinse, repeat. This is fine for a handful of buildings -- but not for dozens or hundreds. So I'm looking for a way to let them paste in a list, and fill out the table from there.

If they can't paste directly into a Repeating Table, could I have them paste into a multiline Text control, and then parse that with an XPath expression? What would that XPath look like? One final limitation: no code-behind C# or VB -- we've decided for the moment that the logistics of deploying forms with code-behinds is too much for the current project.

Any help appreciated...


The only issue I see arising (mainly due to the fact that this solution can't involve codebehind) is the fact that there are no Infopath rules you can use to dynamically add additional nodes to a repeating group (which is what the repeating table is binding to.)

The only way to create additional records in a repeating table is for the user to manually press the "Insert additional row" tab at the bottom of the table.

I'd strongly recommend using codebehind, so a user could paste their tab-delimited excel data from the clipboard into a box; have it parsed serverside; and use that data along with a routine to access the MainDataSource of the form, and add the additional rows that way.


If you extract the source files from infopath, one of the documents will be the template.xml file. this will hold the data for your infopath form. use an excel macro to open the template as an xml document and add the data from the excel spreadsheet. you can then allow the user to open the file themselves or open it for them. Just a way to get around not having codebehind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜