ActiveReports multi columns detail - activereports

My main report includes a subreport in the detail section.
This subreport is designed as follow:
ghHeader1
ghHeader1.ColumnLayout = false; // this header span accross both detail columns
ghHeader1.NewColumn = None
ghHeader1.NewPage = None
ghHeader1.RepeatStyle = OnPage
ghHeader2
ghHeader2.ColumnLayout = true; // this header is specific to each columns of the detail section
ghHeader2.NewColumn = None
ghHeader2.NewPage = None
ghHeader2.RepeatStyle = None
ghHeader2.ColumnGroupKeepTogether = true
ghHeader2.GroupKeepTogether = true
ghHeader2.KeepTogether = true
detail Section
detail.ColumnCount = 2
detail.ColumnDirection = DownAcross
detail.NewColumn = None
detail.NewPage = None
gfFooter2
gfFooter2.NewColumn = After
gfFooter2.NewPage = None
gfFooter2.ColumnLayout = true
gfFooter1
gfFooter1.NewColumn = None
gfFooter1.NewPage = None
gfFooter.ColumnLayout = false
Now, my problem is that with this configuration, when the second column is printed, instead of adding a new group under the first printed column (on the left of the page) it creates a new page even if there is enough space to print the group on the same page.
How can I make the next group print on the same page in the first column ?
I'm using ActiveReports 7.1.7572.
Thanks.

It seems that the issue is being caused due to the setting of "GroupKeepTogether" property. If you will check the details about this property here, you will notice that enabling this property attempts to fit the groupheader and its footer on the same page. If they do not fit then it moves the complete section to the next page.
I tested this issue by creating a similar report but unfortunately could not reproduce the issue. Should you require further assistance, you can post your issue over the GrapeCity support forums.

Related

Birt Conditional Page Break

I'm designing a BIRT report that should print on a form. In this report it is printing in both sides so the client is asking to do a Page Break if the details of a WorkOrder ends in a odd number so both WorkOrders wouldnt be in the same sheet.
Is it possible to add a pagecount() and do a page break if it is the end of the work order an its an odd number?
Thanks in advance.
I only have part of the answer. It would be possible on the adding pagination in the beforeFactory on the ReportDesign section. Out of the box Maximo reports have a pagination statement for PDF's. You can extend the if statement - see example of OOTB code below.
You would need to be able to bring back the WO number as a global parameter. That part is what you would need to do some additional research on.
if ( (reportContext.getParameterValue("usepagebreaks") == "false")|| reportContext.getOutputFormat() == "pdf" ) {
// Give each table in the report a name, and add the names to the list below, e.g. ["mainTable", "childTable1"]
var tableListing = ["dataSet_inventory_id13#"];
for each(var tableName in tableListing) {
var table = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement(tableName)
if (table != null) {
table.setProperty("pageBreakInterval", 0);
}
}
}

Outlook form VBScript for controls

I've created an Outlook form with several bound controls. I would like one of the check boxes when checked to make two text areas and their labels visible, then not be visible if the check box is unchecked. The controls that I want to make visible have the initial state of not-visible. I'm stuck on the VBScript syntax. I've been using Sue Mosher's Outlook programming book, but I'm a newby and I'm not getting it. I'd appreciate any help with this. I'm using Outlook 2010 on a Windows 7 machine. Thanks!
Here's my code:
Sub Item_PropertyChange(byVal Name)
Set objInsp = Item.GetInspector
Set objPage = objInsp.ModifiedFormPages("Message")
Set ckWGC = objPage.Controls("ckWGC")
Set lblState = objPage.Controls("lblState")
Set WGCState = objPage.Controls("WGCState")
Set lblCountry = objPage.Controls("lblCountry")
Set WGCCountry = objPage.Controls("WGCCountry")
If ckWGC.Value = True Then
lblState.Visible = True
WGCState.Visible = True
lblCountry.Visible = True
WGCCountry.Visible = True
Else
lblState.Visible = False
WGCState.Visible = False
lblCountry.Visible = False
WGCCountry.Visible = False
End If
End Sub
You would want to handle the CheckBox.Change event to capture when the user has checked or unchecked it.
Private Sub CheckBox1_Change()
End Sub

Web2py SQLFORM.grid Edit page

I'm using SQLFORM.grid for my form. The view is showing up fine and i can hide fields. But when i go into the Edit page, i want to have certain fields not readable and not writeable. I have set it to be readable=False before the SQLFORM.grid call and also in the request.args == 'edit'. I can confirm it detects the edit page but for some reason, it doesn't run the read and write.
following is the controller:
def display_form():
db.items.timeStamp.readable = False
db.items.imageName.readable = False
db.items.isCopied.writeable = True
query = (db.items.numSold > 100)
default_sort_order = [db.items.numSold]
if len(request.args) > 1 and ('edit' in request.args):
db.items.timeStamp.readable = False
db.items.imageName.writeable = False
form = SQLFORM.grid(query=query, orderby=default_sort_order, create=False,
deletable=False, editable=True, maxtextlength=64, paginate=25, csv=False,
user_signature=False,
links=[dict(header=T('Profit'),body=lambda row: row.profit),
dict(header=T('Image'), body = lambda rowB: A(IMG(_src=URL('static', "images/"+
rowB.imageName.replace('\\','/')), _width=50, _height=50),
_href=URL('static', "images/"+ rowB.imageName.replace('\\','/'))))],
selectable=get_chosenItems
)
else:
form = SQLFORM.grid(query=query, orderby=default_sort_order, create=False,
deletable=False, editable=True, maxtextlength=64, paginate=25, csv=False,
user_signature=False,
links=[dict(header=T('Profit'),body=lambda row: row.profit),
dict(header=T('Image'), body = lambda rowB: A(IMG(_src=URL('static', "images/"+
rowB.imageName.replace('\\','/')), _width=50, _height=50),
_href=URL('static', "images/"+ rowB.imageName.replace('\\','/'))))],
selectable=get_chosenItems
)
return dict(form=form)
I can tell that when on the edit page, it would go in the if statement, however, it totally ignores the readables i set there.
Should i be calling the form once again within the edit page?
I feel that it's redundant.
To prevent fields from being included on edit forms, set both the readable and writable attributes to False. If you set writable to False but leave readable as True, then you'll see a read-only value for the field on the form.

Copy range with conditional formatting

I have a range with Conditional Formatting in an existing Excel file. I used EPPlus to copy that range to a new sheet, then I found the conditional formatting was missing.
Is there any way to copy range with conditional formatting using EPPlus?
I found a solution for this. I did not test it on all formattingRuleTypes. (Only needed 2 of them for the moment)
In my application i have 1 template row for each sheet.
var formatList = fromSheet.ConditionalFormatting.ToList();
foreach (var cf in formatList)
{
// sourceRow is the row containing the formatting
if (cf.Address.Start.Row == sourceRow )
{
IExcelConditionalFormattingRule rule = null;
switch (cf.Type)
{
case OfficeOpenXml.ConditionalFormatting.eExcelConditionalFormattingRuleType.GreaterThan:
rule = dest.ConditionalFormatting.AddGreaterThan();
break;
case OfficeOpenXml.ConditionalFormatting.eExcelConditionalFormattingRuleType.GreaterThanOrEqual:
rule = dest.ConditionalFormatting.AddGreaterThanOrEqual();
break;
case OfficeOpenXml.ConditionalFormatting.eExcelConditionalFormattingRuleType.LessThan:
rule = dest.ConditionalFormatting.AddLessThan();
break;
case OfficeOpenXml.ConditionalFormatting.eExcelConditionalFormattingRuleType.LessThanOrEqual:
rule = dest.ConditionalFormatting.AddLessThanOrEqual();
break;
default:
break;
}
rule.Style.Fill = cf.Style.Fill;
rule.Style.Border = cf.Style.Border;
rule.Style.Font = cf.Style.Font;
rule.Style.NumberFormat = cf.Style.NumberFormat;
// I have no clue why the Formula property is not included in the IExcelConditionalFormattingRule interface. So I needed to cast this.
((ExcelConditionalFormattingRule)rule).Formula = ((ExcelConditionalFormattingRule)cf).Formula;
((ExcelConditionalFormattingRule)rule).Formula2 = ((ExcelConditionalFormattingRule)cf).Formula2;
// Calculate the new address for the formatting. This will be different in your case
var adr = new ExcelAddress( dest.Start.Row , cf.Address.Start.Column -1 , dest.Start.Row, cf.Address.Start.Column -1 + cf.Address.Columns -1 );
rule.Address = adr;
I have no clue why the Formula property is not included in the IExcelConditionalFormattingRule interface. So I needed to cast this.
To add to the answer of Luc Wuyts (I can't comment yet due to limited reputation):
// I have no clue why the Formula property is not included in the IExcelConditionalFormattingRule interface. So I needed to cast this.
((ExcelConditionalFormattingRule)rule).Formula = ((ExcelConditionalFormattingRule)cf).Formula;
((ExcelConditionalFormattingRule)rule).Formula2 = ((ExcelConditionalFormattingRule)cf).Formula2;
Some conditional formatting do not have the Formula-options. This cast will work, but applying the Formula properties to conditional formatting options which do not require it will have unforeseen results. Eg. the ConditionalFormatting.AddContainsBlanks() does not require Formula properties, and adding them might mess up the conditional formatting. A better approach is to check the type, and add the formula's only when required.
I had a similar problem, the only way I found to inspect, change or delete a conditional format of a cell or range is looking at the openxml specs. The conditional format is stored in the worksheet, with the range under the attribute sqref. So you can edit that range or add a new.
For example:
DIM p As New ExcelPackage(New FileInfo(ExlReportPath), True)
Dim ws As ExcelWorksheet = p.Workbook.Worksheets(ExlSheetName)
'--Find Node "worksheet" (1 in my case) , Find all Child Nodes "conditionalFormatting" (5 to 11 in my test)
Print.Debug(ws.WorksheetXml.ChildNodes(1).ChildNodes(5).Name)
'--You get: conditionalFormatting
'--Now you can inspect the range:
Print.Debug(ws.WorksheetXml.ChildNodes(1).ChildNodes(5).Attributes("sqref").Value)
'--Will give you the cell address that this formatting applies to example: "D11:D15"
'--you can change delete or add new range if you want, below I add F11:F15
ws.WorksheetXml.ChildNodes(1).ChildNodes(5).Attributes("sqref").Value="D11:D15 F11:F15"
'--You can inspect the rule itself in the InnerXml also...
If you need more details of the markup, google Wouter van Vugt, "Open XML The markup explained". I found it useful and the full document was online (free).
If you find an easier way please post it.
Regards

OpenXml - Joining word documents with different footers

I'm using http://powertools.codeplex.com and/or http://docx.codeplex.com to join word documents.
The first document contains a footer, the second document does not.
The joined document shows the footer on both pages/sections.
How can I remove the footer of the second section?
The footer of the second section is connected to the preceding section.
How can this connection be removed by using OpenXML 2.0? In Word this is no problem.
My source code can be found here:
http://dl.dropbox.com/u/21096596/OpenXML.zip
I found a solution how the footer of the follow-up sections could be replaced:
MainDocumentPart myPart = document.MainDocumentPart;
FooterPart newFtPart = myPart.AddNewPart<FooterPart>();
string ft_ID = myPart.GetIdOfPart(newFtPart);
new DocumentFormat.OpenXml.Wordprocessing.Footer().Save(newFtPart);
foreach (SectionProperties sectProperties in myPart.Document.Descendants<SectionProperties>().Skip(1))
{
FooterReference newFtReference =
new FooterReference() { Id = ft_ID, Type = HeaderFooterValues.Default };
sectProperties.Append(newFtReference);
}