Suvin Posted May 4, 2010 Report Share Posted May 4, 2010 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. Quote Link to comment
asbo Posted May 4, 2010 Report Share Posted May 4, 2010 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. Quote Link to comment
Suvin Posted May 5, 2010 Author Report Share Posted May 5, 2010 Thanks for that. I am new to labview and activex. Can you please share a sample vi to demonstrate the autofit. Quote Link to comment
Suvin Posted May 6, 2010 Author Report Share Posted May 6, 2010 I tried the row auto fit but unfortunately it is not serving my purpose. Row height is not adjusting according to the length of the content.I am attaching the picture of my code. Can somebody help? Quote Link to comment
asbo Posted May 6, 2010 Report Share Posted May 6, 2010 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.