Link to home
Start Free TrialLog in
Avatar of imperiestro
imperiestro

asked on

Component one 2.0 - no code-compile

I'm trying to implement this code which is a sample from component one for making tables, but appears some mistakes which don't permits to compile totally.  
What's going on bad?

I include code, and the instructions just below

FOR TABLES The sample code fragments in this topic assume that the "using C1.C1Preview" directive (in C# syntax; or an equivalent for other languages) has been inserted into the file, so that instead of fully qualified type names (such as C1.C1Preview.RenderText) we can use just the class name part (RenderText).
FOR IMAGES This topic demonstrates how to add two different images to specific cells in an existing table by using the RenderImage class
FOR PARAGRAPHS The sample code fragments in this topic assume that "using C1.C1Preview;" directive (in C# syntax; or an equivalent for other languages) has been inserted into the file, so that instead of fully qualified type names (such as C1.C1Preview.RenderText) we can use just the class name part (RenderText).

So I added the references

C1.C1Preview
C1.Win.C1Preview
ComponentOneC1Report
ComponentOnePrintDocument
ComponentOnePrintPreview

These are errors

Error      1      'C1PrintDocument1' is not a member of '_Default'. Line 15
Error      2      'Cells' is not a member of 'C1.C1Preview.RenderText'. Line 20
Error      3      'C1PrintDocument1' is not a member of '_Default'. Line 31
Error      4      Name 'Color' is not declared. Line 32
Error      5      'C1PrintDocument1' is not a member of '_Default'.  Line 40
Error      6      'C1PrintDocument1' is not a member of '_Default'.  Line 49
Error      7      'C1PrintDocument1' is not a member of '_Default'. Line 50
Error      8      Type 'RenderParagraph' is not defined.      Line 57
Error      9      Type 'Font' is not defined.      Line 58
Error      10      Name 'Color' is not declared.      Line 62
Error      11      Name 'Color' is not declared.      Line 64
Error      12      Name 'Color' is not declared.      Line 65
Error      13      'Icon' is not a member of '_Default'.      Line 69
Error      14      'C1PrintDocument1' is not a member of '_Default'.      Line 73
Error      15      'C1PrintDocument1' is not a member of '_Default'.      Line 74
Error      16      'C1PrintDocument1' is not a member of '_Default'.      Line 94
Error      17      'C1PrintDocument1' is not a member of '_Default'.      Line 95

I'd appreciate your help about this
Imports C1.Win.C1Preview 'preview
Imports C1.Win.C1Report 'reports
Imports C1.Win.C1PrintPreview 'print preview
Imports C1.C1Preview.RenderObject
Imports C1.C1Preview.RenderParagraph
Imports C1.C1Preview.RenderText 'rendering texts
Imports C1.C1PrintDocument
Imports System.IO


Partial Class _Default
    Inherits System.Web.UI.Page

    Public Sub tables()
        Dim rt As New C1.C1Preview.RenderText
        Me.C1PrintDocument1.Body.Children.Add(rt)
        Dim row As Integer = 0
        Do While (row < 10)
            Dim col As Integer = 0
            Do While (col < 6)
                rt.Cells.Item(row, col).Text = String.Format("Cell ({0},{1})", row, col)
                col += 1
            Loop
            row += 1
        Loop

    End Sub

    Public Sub images()

        ' Make a table.
        Dim table As C1.C1Preview.RenderTable = New C1.C1Preview.RenderTable(Me.C1PrintDocument1)
        table.Style.GridLines.All = New C1.C1Preview.LineDef(Color.DarkGray)

        Dim r As Integer = 3
        Dim c As Integer = 3
        Dim row As Integer
        Dim col As Integer
        For row = 0 To r - 1 Step +1
            For col = 0 To c - 1 Step +1
                Dim celltext As C1.C1Preview.RenderText = New C1.C1Preview.RenderText(Me.C1PrintDocument1)

                ' Add empty cells.
                celltext.Text = String.Format("", row, col)
                table.Cells(row, col).RenderObject = celltext
            Next
        Next

        ' Generate the document.
        Me.C1PrintDocument1.Body.Children.Add(table)
        Me.C1PrintDocument1.Generate()

    End Sub

    Public Sub paragraphs()
        ' Create a paragraph.
        Dim rpar As New RenderParagraph()
        Dim f As New Font(rpar.Style.Font, FontStyle.Bold)

        rpar.Content.AddText("This is a paragraph. This is normal text. ")
        rpar.Content.AddText("This text is bold. ", f)
        rpar.Content.AddText("This text is red. ", Color.Red)
        rpar.Content.AddText("This text is superscript. ", TextPositionEnum.Superscript)
        rpar.Content.AddText("This text is bold and red. ", f, Color.Red)
        rpar.Content.AddText("This text is bold and red and subscript. ", f, Color.Red, TextPositionEnum.Subscript)
        rpar.Content.AddText("This is normal text again. ")
        rpar.Content.AddHyperlink("This is a link to the start of this paragraph.", rpar.Content(0))
        rpar.Content.AddText("Finally, here is an inline image: ")
        rpar.Content.AddImage(Me.Icon.ToBitmap())
        rpar.Content.AddText(".")

        ' Add the paragraph to the document.
        Me.C1PrintDocument1.Body.Children.Add(rpar)
        Me.C1PrintDocument1.Generate()

    End Sub

    Protected Sub DrpDwsnLstTheme_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DrpDwsnLstTheme.SelectedIndexChanged
        Dim schoice As String
        schoice = ""
        schoice = Trim(DrpDwsnLstTheme.SelectedValue)
        If schoice = "Table" Then
            tables()
        ElseIf schoice = "Image" Then
            images()
        ElseIf schoice = "Paragraph" Then
            paragraphs()
        ElseIf schoice = "" Then

        End If
    End Sub

    Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
        Me.C1PrintDocument1.Body.Children.Add(New C1.C1Preview.RenderText("Hello, World!"))
        Me.C1PrintDocument1.Generate()
    End Sub
End Class

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of imperiestro
imperiestro

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial