不同的表,如有表某列占两列,则其他所有表该列均应占两列
1,先算出整体占总列数
<#assign m_weeks = 0>
<#assign maxColumn0 = 0>
<#assign maxColumn1 = 0>
<#assign maxColumn2 = 0>
<#assign maxColumn3 = 0>
<#assign maxColumn4 = 0>
<#assign maxColumn5 = 0>
<#assign maxColumn6 = 0>
<#list 0..6 as weekIndex>
<#if disTime.days[weekIndex]>
<#assign m_weeks = m_weeks + 1>
</#if>
</#list>
<#assign totalColumn=0>
<#assign totalColumnSum = 0>
<#list list as p>
<#if p.totalColumn gt totalColumn> <#assign totalColumn=p.totalColumn></#if>
<#list 0..6 as weekIndex>
<#if disTime.days[weekIndex]>
<#if weekIndex==0> <#if p.maxColumn[weekIndex] gt maxColumn0> <#assign maxColumn0=p.maxColumn[weekIndex]></#if>
<#elseif weekIndex==1> <#if p.maxColumn[weekIndex] gt maxColumn1> <#assign maxColumn1=p.maxColumn[weekIndex]></#if>
<#elseif weekIndex==2> <#if p.maxColumn[weekIndex] gt maxColumn2> <#assign maxColumn2=p.maxColumn[weekIndex]></#if>
<#elseif weekIndex==3> <#if p.maxColumn[weekIndex] gt maxColumn3> <#assign maxColumn3=p.maxColumn[weekIndex]></#if>
<#elseif weekIndex==4> <#if p.maxColumn[weekIndex] gt maxColumn4> <#assign maxColumn4=p.maxColumn[weekIndex]></#if>
<#elseif weekIndex==5> <#if p.maxColumn[weekIndex] gt maxColumn5> <#assign maxColumn5=p.maxColumn[weekIndex]></#if>
<#elseif weekIndex==6> <#if p.maxColumn[weekIndex] gt maxColumn6> <#assign maxColumn6=p.maxColumn[weekIndex]></#if>
</#if>
</#if>
</#list>
</#list>
<#assign totalColumnSum = maxColumn0+maxColumn1+maxColumn2+maxColumn3+maxColumn4+maxColumn5+maxColumn6>
<#if totalColumnSum gt totalColumn> <#assign totalColumn=totalColumnSum></#if>
<#list list as p>
<#assign w_final = 1000 * birtBrowser.widthRatio/((totalColumn + 1)*2)>
2,每个表的每列,均应按照最大列数展示
<row id="${idNo?c}">
<property name="forceFit">true</property>
.....
<#if disTime.days[0]>
<#assign idNo = idNo + 1>
<cell id="${idNo?c}">
<property name="width">${maxColumn0*w_final}px</property>
<property name="colSpan">${maxColumn0}</property>
<#if disTime.days[1]>
<#assign idNo = idNo + 1>
<cell id="${idNo?c}">
<property name="width">${maxColumn1*w_final}px</property>
<property name="colSpan">${maxColumn1}</property>
3,实际表内容,控制占列
<#assign amColspan = 0>
<#assign amCellColspan = 0>
<#assign amCellNum = 0>
<#list am as amCell>
<#if amCell.show == 1>
<#assign amColspan=1>
<#if amCellNum==0> <#assign amCellColspan=maxColumn0>
<#elseif amCellNum==1> <#assign amCellColspan=maxColumn1>
<#elseif amCellNum==2> <#assign amCellColspan=maxColumn2>
<#elseif amCellNum==3> <#assign amCellColspan=maxColumn3>
<#elseif amCellNum==4> <#assign amCellColspan=maxColumn4>
<#elseif amCellNum==5> <#assign amCellColspan=maxColumn5>
<#elseif amCellNum==6> <#assign amCellColspan=maxColumn6>
</#if>
<#if amCell.size != 0>
<#assign cellColspanLeft = 0>
<#assign amColspan=1>
<#assign amColspan=amCellColspan/amCell.size>
<#assign amCellNum=amCellNum+1>
<#list amCell.courses as course>
<#assign idNo = idNo + 1>
<cell id="${idNo?c}">
<property name="width">${amColspan*w_final}px</property>
<property name="colSpan">${amColspan}</property>
<property name="rowSpan">${amCell.rowspan}</property>
<#assign m_course_width = w_final*amColspan>
<#assign m_course_height = m_height>
<#assign n_pcnl = (course.printCourseName?length)>
<#assign n_cm = m_course_width*6/67>