0

I am using sharpPDF plugin in Unity.

I see that there is .rowStyle and .alternateRowStyle in there, but I need all rows (or even maybe cells) to be different color. For example first row should be Red, second should be Blue, third should be Yellow etc.

Is that possible? Thank you.

filipst
  • 1,547
  • 1
  • 30
  • 55
  • Can you provide us with your code? I don't use sharpPDF and never have, but if I can see something I might be able to work something out. Do you know how to set the color of a row? – Hobbyist Nov 04 '14 at 15:03
  • `pdfTableRow myRow = myTable.createRow(); myRow[0].columnValue = "1"; myRow[1].columnValue = "Correct"; myTable.addRow(myRow); myTable.rowStyle = new pdfTableRowStyle(predefinedFont.csCourier,8,new pdfColor(predefinedColor.csBlack),new pdfColor(predefinedColor.csLightGreen)); myTable.alternateRowStyle = new pdfTableRowStyle(predefinedFont.csCourier,8,new pdfColor(predefinedColor.csBlack),new pdfColor(predefinedColor.csLightRed));` – filipst Nov 04 '14 at 15:05
  • You're explaining a table inside of your question, but you're asking about a PDF document, are you trying to create a table inside of the PDF? === You edited that really fast, lol, put the code in your original question using the `edit` feature so it's formatted. – Hobbyist Nov 04 '14 at 15:07
  • Check to see if myRow[1].rowStyle is available – Hobbyist Nov 04 '14 at 15:09
  • Clicked enter accidently. I am making a PDF with a table in Unity. I have to make some kind of statistic for a quiz. All questions have to be in separate rows, and if it was answered correctly it should be green, and if not, it should be red. – filipst Nov 04 '14 at 15:10
  • Not available like that. – filipst Nov 04 '14 at 15:11
  • May I ask why you're using sharpPDF for this? Is it required, or just a solution you thought of? – Hobbyist Nov 04 '14 at 15:12
  • It is not required. Any other suggestions? I am opened for everything atm :) – filipst Nov 04 '14 at 15:12
  • It would be very simple using the new UI, I could write the code for you if you'd like, but you'd have to download Unity 4.6. – Hobbyist Nov 04 '14 at 15:16
  • You could export PDF file like that? – filipst Nov 04 '14 at 15:19
  • No, I was under the impression that you were just trying to display a table, you'd be suprised the amount of work-arounds people have used with the old UI System. I've searched high and low through the documents of sharpPDF, but I can't find any way to change the rows color by itself. – Hobbyist Nov 04 '14 at 15:23
  • 1
    Another solution would be iTextSharp, here's an example doing what you'd like -- http://stackoverflow.com/questions/24053963/add-header-footer-and-background-color-to-pdf-cells-in-itextsharp – Hobbyist Nov 04 '14 at 15:24
  • Yeah, it is required to export PDF file. I will take a look at iTextSharp. Can it be used on all platforms (iOS, android, windows phone, PC, Mac, Web)? – filipst Nov 04 '14 at 15:26
  • I'm not entirely sure, I don't personally use it. – Hobbyist Nov 04 '14 at 17:53

0 Answers0