コード例 #1
0
ファイル: Html5TableSerializer.cs プロジェクト: trygu/PxWeb
        private void WriteHeadings(System.IO.StreamWriter wr, PCAxis.Paxiom.PXModel model)
        {
            Variables heading = model.Meta.Heading;

            if (!(heading == null))
            {
                int[] subHeadings = new int[2];
                if ((heading.Count > 0))
                {
                    Array.Resize(ref subHeadings, heading.Count);
                }

                CalculateSubValues(heading, 0, ref subHeadings);
                int timesToWrite = 1;
                //  This keep track of the number of times the current heading shall be written
                int timesWritten = 0;
                //  This keep track of the number of times the current heading has been written
                for (int index = 0; (index
                                     <= (heading.Count - 1)); index++)
                {
                    wr.WriteLine("<tr>");
                    if ((model.Meta.Stub.Count > 0))
                    {
                        wr.WriteLine("<th></th>");
                    }

                    //  Write the heading
                    int valuesCount = heading[index].Values.Count;
                    for (int j = 0; (j
                                     <= (timesToWrite - 1)); j++)
                    {
                        Paxiom.Values headingValues = heading[index].Values;
                        for (int ix = 0; (ix
                                          <= (headingValues.Count - 1)); ix++)
                        {
                            if (index == heading.Count - 1)
                            {
                                wr.Write(@"<th scope=""col""");
                            }
                            else
                            {
                                wr.Write("<th colspan=");
                                wr.Write(subHeadings[index]);
                            }



                            wr.Write(">");
                            wr.Write(headingValues[ix].Text);
                            wr.WriteLine("</th>");
                            timesWritten = (timesWritten + 1);
                        }
                    }

                    timesToWrite = timesWritten;
                    timesWritten = 0;
                    wr.WriteLine("</tr>");
                }
            }
        }
コード例 #2
0
ファイル: Html5TableSerializer.cs プロジェクト: trygu/PxWeb
        private void WriteTable(System.IO.StreamWriter wr, Paxiom.PXModel model, int levels, int level, int precision, ref int row)
        {
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.InvariantCulture;
            _fmt = new DataFormatter(model);
            Variables heading = model.Meta.Heading;

            if ((level == levels))
            {
                //  Time to write the data to the file
                WriteDataLine(wr, model, ci, precision, row);
                //  Close this row. The closing tag is not writen if level + 1 < levels, se
                //  the else clause below
                wr.WriteLine("</tr>");
                row = (row + 1);
            }
            else
            {
                Paxiom.Values values    = model.Meta.Stub[level].Values;
                int           nextLevel = (level + 1);
                for (int i = 0; (i <= (values.Count - 1)); i++)
                {
                    wr.WriteLine("<tr>");
                    wr.Write(@"<th scope=""row"">");

                    wr.Write(values[i].Text);
                    wr.WriteLine("</th>");
                    _fmt = new DataFormatter(model);

                    int decimals = model.Meta.ShowDecimals;
                    if (values[i].HasPrecision())
                    {
                        decimals = values[i].Precision;
                    }

                    if (level + 1 < levels)
                    {
                        for (int y = 0; y <= model.Data.MatrixColumnCount - 1; y++)
                        {
                            wr.WriteLine("<td></td>");
                        }
                        wr.WriteLine("</tr>");
                    }


                    WriteTable(wr, model, levels, nextLevel, decimals, ref row);
                }
            }
        }