I have a single crystal report that usually ends up about 150 pages long. The single .rpt, through the use of clever grouping, actually includes records with little individual header and footer sections for each customer. Think of it as a sales report for 100 customers, each with their own section.
Each customer section is 2 to 7 pages in length.
We would like to print on the front and back of pages. However, my concern is that approximately half of the customer sections would begin printing on the back side of the last page of the previous customer section.
Edit: What this boils down to... I need to insert an extra page break if the current page number is odd. Any ideas?
well if all your asking for is a formula to insert a page break when page number is odd then add this to the New Page After or New Page Before formula on the desired Section of the report.
PageNumber Mod 2 = 1
Sorry I cant be of more help but Im having trouble understanding your question.
EDITED:
Thanks for the clarification
basically in your grouping for your customer (ie "little individual footer section"), you will need to do something like this in the New Page After formula
(Next({Customer.CustomerId}) <> {Customer.CustomerId})
AND
(PageNumber MOD 2 = 1)
Note Customer.CustomerID should reference a unique value for your customer in your recordset. I just made something up since I dont know your data field names. Basically the forumla above will look at the Next Unique Customer and if it is not the same value as the current customer, then you know that a new Customer section is starting. Combine that logic with weather or not the PageNumber is odd and you can tell weather or not you need to insert a page break.
EDITED 2
(ISNULL(Next({Customer.CustomerId})) OR Next({Customer.CustomerId}) = "")
AND
(Next({Customer.CustomerId}) <> {Customer.CustomerId})
AND
(PageNumber MOD 2 = 1)
You may want to check if Next Customer ID (IE Unique Customer Value) is null this way you dont end up with a blank page at the very end of the report.
Related
I have a long document with about 9 Parts and each part contains 2 - 5 sections. I want to have my page numbers read Part-Section-Page. For example, page 5 of section 4 in part 3 would have the page number 3-4-5.
Using this field code I can output this correct page number in my footer
{STYLEREF 1 \s}-{STYLEREF 2 \s}-{PAGE}
This works because the first field code outputs the current Part, signified by Header 1, the 2nd code outputs the section number signified by Header 2, and then last output is the page which I can control with section breaks.
BUT - This is no help with the Table of Contents! When the ToC is generated, Word only recognizes {PAGE} as the page number, and therefore I need to manually write the ToC.
Is there any way to make the page number actually be in the format x-y-x?
Any ideas or help would be appreciated!
I am currently working with a client that generates their invoices manually in Excel. I have used epplus to generate this file automatically for them.
One of the requirements I have is that each page should have a border around it and start with a header that is about 7 rows long (and each row has different heights based on what I have to put in them). In order to do this, I need to detect when I am at the end of a page so that I can pause my data printing and print out the header, then print out all the data for that page and print the border on the page based on how many rows are on the page.
This was a bit easier when the row heights were static because I could just assume that based on the page settings, that there were a specific amount of rows per page. However, some of the rows on the invoice can have multiple lines which means that WrapText = true. This obviously alters the numbers of rows on the page which throws all my formatting off.
Is there a way to calculate how many rows are on a page and detect when I am on a row where the page ends?
Thanks in advance for any help
To get the row count, and column count, I used the following code:
// get the first worksheet in the workbook
ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets[1];
//Gets the row count
var rowCnt = worksheet.Dimension.End.Row;
//Gets the column count
var colCnt = worksheet.Dimension.End.Column;
I have a simple dropdown list named DD8. It uses 50 rows as control, the problem is that for now only 45 rows are used. That means that in the dropdown list there are 5 empty rows. The problem is that if someone select one empty row, or don't select anything (default is empty) the fallowing code will show error :
With Worksheets(1)
NameProf = .DropDowns("DD8").List _
(.DropDowns("DD8").ListIndex)
End With
I tried things like if .DropDowns("DD8").List (.DropDowns("DD8").ListIndex) != "" but ofc, it shows error. I searched how to select only used rows with the DropDown list of the development tab but it doesn't seem to be possible.
I have to select 50 rows because new customers can be added.
Do you know how it can be achieved ?
If new customers can be added, then I imagine, and hope for you, that it goes above 50.... so it's not just an issue of having 5 blanks for now to not be an option, but also allowing customers 50-2,483 also be on there when they come along. ---- Without more details on your code, I believe this suggestion should help 'guide' you but not immediately solve your issue.
Essentially, whenever you call to have your dropdown populated, you want some code to find the last row of data in the customers column, and then assign your dropdown to populate with the starting row of your customers to the lastrow. This way no matter how many customers you have 2, 48, 189... they will show in your dropdown without that issue occurring. A simple google search will yield how to find the last row in excel.
Sorry I couldn't just bust out the code to make it work for you right this second, but I think this should be a good starting point for you.
Using Excel, lets say I have a validation list made of 5 values like this one :
Patate
Tomate
Courgette
Concombre
Patate
In a cell containing a drop down list made of these 5 value, I select the fifth value : "Patate".
I want to get in VBA that this cell contains the 5th value of my validation list. Something like :
x = Cell.Validation.GetIDValueSelected
x = 5
I can't use Vertical search because I might have 2 or even more time the same value in my list (too long to explain why).
This list is also dynamics (depending of another sheets) so it doesn't always contains 5 values.
I hope I made it clear for everyone to understand my needs but I will be glad to add more information if needed.
Thank you for your time.
Sadly, once you have used DV to fill a cell with junk, there is no way to tell which piece of junk you picked:
You would have to pad each piece of junk with a different number of blanks.
I have one sheet which is comprised of data that was imported from a web page. In a second sheet I have a cell asking for min price and max price which comes from the imported data. The issue is that the data can move to different cells when it's refreshed so my code needs to look for some specific wording to find the prices that I need rather than just directing it to the same cell each time
The info in the imported data sheet which I need to extract from will always be in this string of text which will always be found somewhere between row 15-35 but will move when the website is refreshed. The 1st number (71.00) needs to be extracted to another sheet in a cell asking for min price while the second number (75.00) is the max price. These prices can change so I can just look for those numbers and extract them.
SLAUGHTER BULLS: Yield grade 1-2 1000-1500 lbs
1500-2000 lbs 71.00-75.00.
Could someone please help me with the coding for this macro?
Use the InStrRev function (similar to the LastIndexOf function in .NET) to find the last index of "lbs" in the test string.
lastIndex = InStrRev(testString, "lbs", 1, 1)
Then search from that last index to the end of the string spliting on the -
splitArray = Split(Mid(testString, lastIndex, Len(testString) - lastIndex), "-", 1)
The lowest value will be in splitArray(0) and the upper value will be in splitArray(1) assuming a zero indexed array.