internal static DataTable_internal DeserializeDataTable_internal(JsonElement element)
        {
            DataTable_internal result = new DataTable_internal();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("rows"))
                {
                    result.Rows = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("columns"))
                {
                    result.Columns = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("cells"))
                {
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Cells.Add(DataTableCell_internal.DeserializeDataTableCell_internal(item));
                    }
                    continue;
                }
            }
            return(result);
        }
        internal static DataTable_internal DeserializeDataTable_internal(JsonElement element)
        {
            int rows    = default;
            int columns = default;
            IReadOnlyList <DataTableCell_internal> cells = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("rows"))
                {
                    rows = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("columns"))
                {
                    columns = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("cells"))
                {
                    List <DataTableCell_internal> array = new List <DataTableCell_internal>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DataTableCell_internal.DeserializeDataTableCell_internal(item));
                    }
                    cells = array;
                    continue;
                }
            }
            return(new DataTable_internal(rows, columns, cells));
        }
Ejemplo n.º 3
0
 internal FormTableCell(DataTableCell_internal dataTableCell, IReadOnlyList <ReadResult_internal> readResults, int pageNumber)
     : base(new BoundingBox(dataTableCell.BoundingBox), pageNumber, dataTableCell.Text)
 {
     ColumnIndex = dataTableCell.ColumnIndex;
     ColumnSpan  = dataTableCell.ColumnSpan ?? 1;
     Confidence  = dataTableCell.Confidence;
     IsFooter    = dataTableCell.IsFooter ?? false;
     IsHeader    = dataTableCell.IsHeader ?? false;
     RowIndex    = dataTableCell.RowIndex;
     RowSpan     = dataTableCell.RowSpan ?? 1;
     TextContent = dataTableCell.Elements != null
         ? FormField.ConvertTextReferences(dataTableCell.Elements, readResults)
         : new List <FormContent>();
 }
Ejemplo n.º 4
0
        internal FormTableCell(DataTableCell_internal dataTableCell, ReadResult_internal readResult, IReadOnlyList <string> references)
            : base(new BoundingBox(dataTableCell.BoundingBox), readResult.Page, dataTableCell.Text)
        {
            ColumnIndex = dataTableCell.ColumnIndex;
            ColumnSpan  = dataTableCell.ColumnSpan ?? 1;
            Confidence  = dataTableCell.Confidence;
            IsFooter    = dataTableCell.IsFooter ?? false;
            IsHeader    = dataTableCell.IsHeader ?? false;
            RowIndex    = dataTableCell.RowIndex;
            RowSpan     = dataTableCell.RowSpan ?? 1;

            if (references != null)
            {
                TextContent = ExtractedField.ConvertTextReferences(readResult, references);
            }
        }
Ejemplo n.º 5
0
        internal ExtractedTableCell(DataTableCell_internal dataTableCell, ReadResult_internal readResult, IReadOnlyList <string> references)
        {
            BoundingBox = new BoundingBox(dataTableCell.BoundingBox);
            ColumnIndex = dataTableCell.ColumnIndex;
            ColumnSpan  = dataTableCell.ColumnSpan ?? 1;
            Confidence  = dataTableCell.Confidence;
            IsFooter    = dataTableCell.IsFooter ?? false;
            IsHeader    = dataTableCell.IsHeader ?? false;
            RowIndex    = dataTableCell.RowIndex;
            RowSpan     = dataTableCell.RowSpan ?? 1;
            Text        = dataTableCell.Text;

            if (references != null)
            {
                RawExtractedItems = ExtractedField.ConvertTextReferences(readResult, references);
            }
        }
        internal static DataTableCell_internal DeserializeDataTableCell_internal(JsonElement element)
        {
            DataTableCell_internal result = new DataTableCell_internal();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("rowIndex"))
                {
                    result.RowIndex = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("columnIndex"))
                {
                    result.ColumnIndex = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("rowSpan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.RowSpan = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("columnSpan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.ColumnSpan = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("text"))
                {
                    result.Text = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("boundingBox"))
                {
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.BoundingBox.Add(item.GetSingle());
                    }
                    continue;
                }
                if (property.NameEquals("confidence"))
                {
                    result.Confidence = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("elements"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.Elements = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Elements.Add(item.GetString());
                    }
                    continue;
                }
                if (property.NameEquals("isHeader"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.IsHeader = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("isFooter"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.IsFooter = property.Value.GetBoolean();
                    continue;
                }
            }
            return(result);
        }