• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1175
  • Last Modified:

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

0
imperiestro
Asked:
imperiestro
1 Solution
 
imperiestroAuthor Commented:

I solved this question by myself.  I found some errors during code-construction.  
 
First, I wrote several imports but I supplied with the controls
 
c1PrintDocument and
c1PreviewControl,
 
Those solved errors like
 
'C1PrintDocument1' is not a member of '_Default'
 
And replaced line 15
 
Dim rt As New C1.C1Preview.RenderText
 
With this
 
Dim rt As New C1.C1Preview.RenderTable
 
Besides, the controls were installed badly for web, so I used same for Winforms
 Anyway thanks
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now