Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Download (
|
MacroPlan macroPlan,
|
OfflinePlanRows selectedOPRs
|
) as BinaryValue
|
{
|
TextBody:
|
[*
|
xmlDOMI := XMLDOMImplementation::Create();
|
xmlDOM := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>Sheet1</name></table>' );
|
|
tableElement := xmlDOM.GetElementByTagName( "table", 0 );
|
|
opt := maxselect( macroPlan, OfflinePlanTable, tempOPT, true, tempOPT.SaveDateTime() );
|
opcs := selectsortedset( opt, OfflinePlanColumn, tempOPC, true, tempOPC.ColumnDate() );
|
oprs := selectsortedset( selectedOPRs, Elements, tempOPR, true, tempOPR.ProductionLine(), tempOPR.ProductID(), tempOPR.Type() );
|
traverse ( opcs, Elements, opc ) {
|
column := xmlDOM.CreateElement( "column" );
|
name := xmlDOM.CreateElement( "name" );
|
type := xmlDOM.CreateElement( "type" );
|
name.TextContent( ifexpr( opc.ColumnDate() < macroPlan.StartOfPlanning().Date(), "*", opc.ColumnDate().Format( "Y/M2/D2" ) ) );
|
type.TextContent( "String" );
|
column.AppendChild( name );
|
column.AppendChild( type );
|
|
traverse ( oprs, Elements, opr ) {
|
c := select( opc, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanRow() = opr );
|
cell := xmlDOM.CreateElement( "cell" );
|
cell.SetAttribute( "value", guard( c.Value(), "" ) );
|
column.AppendChild( cell );
|
}
|
|
tableElement.AppendChild( column );
|
}
|
|
xmlString := xmlDOMI.CreateSerializer().WriteToString( xmlDOM )
|
|
//info( xmlString );
|
|
tableGroupHandle := TableGroupHandle::Create( "Sheet1" );
|
tableHandle := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
|
tableGroupHandle.Add( tableHandle );
|
|
binaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
|
|
return binaryData.AsBinaryValue();
|
*]
|
}
|