troubleshooting Question

Component one 2.0 - no code-compile

Avatar of imperiestro
imperiestro asked on
DatabasesVisual Basic Classic.NET Programming
1 Comment1 Solution1244 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros