Exemplo n.º 1
0
 private void insert_questions(Quastionnaire.Model.Questionaire questionaire)
 {
     double yh = 20;
     XRect xrt = new XRect(x, y, page.Width, page.Height);
     for (int i=0;i<questionaire.QuestionList.Count;i++)
     {
        gfx.DrawString((i+1).ToString()+ ". "+ questionaire.QuestionList.ElementAt(i).Question_descr , font, XBrushes.Black, xrt, XStringFormats.TopLeft);
        xrt.Y += yh;
         if (page.Height<=xrt.Y+10+font.Size)
         {
             xrt.Y = yh;
             page = document.AddPage();
             gfx = XGraphics.FromPdfPage(page);
             xrt.X = 40;
             page_orientation();
         }
         for (int j=0;j< questionaire.QuestionList.ElementAt(i).AnswerList.Count;j++)
         {
             xrt.X =60;
             gfx.DrawString((j + 1).ToString() + ". " + questionaire.QuestionList.ElementAt(i).AnswerList.ElementAt(j).Answer_descr, font, XBrushes.Black, xrt, XStringFormats.TopLeft);
             xrt.Y += yh;
             if (page.Height <= xrt.Y + 10 + font.Size)
             {
                 xrt.Y = yh;
                 page = document.AddPage();
                 gfx = XGraphics.FromPdfPage(page);
                 xrt.X = 40;
                 page_orientation();
             }
         }
         xrt.X = 40;
     }
 }
Exemplo n.º 2
0
 //Constructor passing the Questionaire object to create athe pdf.
 public Export_to_Pdf(Quastionnaire.Model.Questionaire questionaire)
     : this()
 {
     this.questionaire = questionaire;
 }
Exemplo n.º 3
0
        private void initialize_question(Quastionnaire.Model.Questionaire questionaire)
        {
            int number_of_erotiseis = 20;
            int number_of_answer = 4;
            //Dimiourgoume tin lista ton apantiseon.
            List<Answer> answs = new List<Answer>();
            Question quest = new Question() { AnswerList = answs};
            quest.Question_descr = "H ekfoonisi tis erotisis aytis einai blablbalbablbalblab";
            for (int i = 0; i < number_of_erotiseis; i++)
            {
                questionaire.QuestionList.Add(quest);
            }
            //MessageBox.Show(lst.Count().ToString());
            //Put the question in questionaire
            //questionaire.QuestionList.AddRange(lst);
            //List<int> deepCopy = new List<int>(originalList);
            MessageBox.Show(questionaire.QuestionList.Count.ToString());
            //List<Answer> answs = new List<Answer>();

            Answer ans = new Answer();
            ans.Answer_descr = "einai to dsfgdsfgsd";

            for (int i=0;i< questionaire.QuestionList.Count;i++)
            {
                for (int j = 0; j < number_of_answer; j++)
                {
                    questionaire.QuestionList.ElementAt(i).AnswerList.Add(ans);
                }
            }
        }