Jump to content

Dynamically inserting data to make a report


Recommended Posts

Hi all, I am facing a problem with report generation. Currently I am making reports using excel templates. I am attaching the picture of sample template here. As you can see B22 is the location of item 1 and B23 is the location for Description 1. Space for description is fixed. Now B30 is the location for item name 2 and B31 is the location for item description 2. My problem is, if description of the item 1 is very small, that already allocated space will be waste.Or if Description 1 is very large, I cannot accomodate it in the given space. So I need item name 2 to come exactly under description 1, rather than fixing the space for item name 2 and subsequent rows. In short, the allocation should be dynamic, according to the size of the descriptions. Is it possible through LABView? Any ideas?

I dont need it to be done with excel only. I need that format of my quotation should be same thats all..Is there any other ways to do this?

Thanks in advance,

Suvin.

post-17366-12729533427_thumb.jpg

Link to comment

Using ActiveX automation, you could command that row/column to autofit. If you're not familiar with Excel ActiveX automation, search around LAVA a bit; there's been a few threads about it.

As for alternatives, you might consider generating an HTML report instead.

Link to comment

Why would you expect row height to adjust to the -length- of your content? I would expect a column autofit to do that. This would be easier to troubleshoot if you uploaded your actual code and a sample spreadsheet.

In any event, you probably can't autofit a collection of rows all at once. You'll have to iterate through the rows you care about (UsedRange might be useful for this) and then do an autofit on that. Conversely, you can select the cell you want autofit (Range("B2","B2")), get the EntireRow and EntireColumn property and run the autofit method of that.

I just noticed that your description field is actual a merged cell; not sure how much that will complicate things.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...

Important Information

By using this site, you agree to our Terms of Use.