Telerik Forums
Telerik Document Processing Forum
1 answer
63 views

Hello,

I have a corrupted XLSX file from CSV dataSource

With other CSV dataSource all is ok

In example in file-attach, I added CSV dataSource with corruption

There are 2 bad lines in generated XLSX file and CSV file have a good format !!!

It's not an issue with codepage or separator !

It's a projet DotNet Core 6 with last version 2023.2.713.20 of API

Do you have encountered this error already ?

Best regards

Cyril REILER

 

 

 

Cyril
Top achievements
Rank 1
Iron
 updated answer on 26 Sep 2023
1 answer
149 views

Hi all,

This is a fragment from my code where I use tables in a RadFlowDocument to list some values. This all works fine for me, except one thing: between the text in a cell en the bottom border of that cell is some white space I can't get rid of. I want the bottom border of the cell to have the same distance to the text in the cell as between the text and the top border (border color set to blue for debugging..)

Tried playing with the row Height, cell padding, etc., but that doesn't change anything.

What am I missing?

  

var doc = new RadFlowDocument(); var tableStyle = new Style("TableStyle", StyleType.Table); tableStyle.TableProperties.Borders.LocalValue = new TableBorders(new Border(1, BorderStyle.Single, new ThemableColor(Colors.Blue))); tableStyle.TableProperties.Alignment.LocalValue = Alignment.Left; tableStyle.TableCellProperties.VerticalAlignment.LocalValue = VerticalAlignment.Top; tableStyle.TableCellProperties.Padding.LocalValue = new Padding(0, 0, 0, 0); tableStyle.TableRowProperties.TableCellSpacing.LocalValue = 0; tableStyle.CharacterProperties.FontSize.LocalValue = 12; doc.StyleRepository.Add(tableStyle); var section = new Section(doc) { PageMargins = new Padding(50, 50, 50, 50), PageNumberingSettings = { StartingPageNumber = 1, } }; doc.Sections.Add(section); var paragraph = new Paragraph(doc); section.Blocks.Add(paragraph); Table table = new Table(doc, 0, 2)// 0 rows, 2 columns. { LayoutType = TableLayoutType.FixedWidth, PreferredWidth = new TableWidthUnit(700), StyleId = "TableStyle" };
// add 2 rows with 2 cells TableRow row = table.Rows.AddTableRow(); TableCell cell = row.Cells.AddTableCell(); cell.PreferredWidth = new TableWidthUnit(100); paragraph = cell.Blocks.AddParagraph(); paragraph.Inlines.AddRun($"Cell R1C1"); cell = row.Cells.AddTableCell(); cell.PreferredWidth = new TableWidthUnit(600); paragraph = cell.Blocks.AddParagraph(); paragraph.Inlines.AddRun("Cell R1C2"); cell = row.Cells.AddTableCell(); cell.PreferredWidth = new TableWidthUnit(100); paragraph = cell.Blocks.AddParagraph(); paragraph.Inlines.AddRun($"Cell R2C1"); cell = row.Cells.AddTableCell(); cell.PreferredWidth = new TableWidthUnit(600); paragraph = cell.Blocks.AddParagraph(); paragraph.Inlines.AddRun("Cell R2C2");


Kind regards,

Kees Alderliesten

Vladislav
Telerik team
 answered on 13 Sep 2023
0 answers
139 views
0 answers
253 views
     public void UnzipTSWFiles(string sourceDirectory, string destinationDirectory, string password)
        {
            DefaultEncryptionSettings protectionSettings = new DefaultEncryptionSettings() { Password = password };

                 using (ZipArchive zipArchive = new ZipArchive(output, ZipArchiveMode.Read, true, null, null, protectionSettings))
                        {
                            foreach (ZipArchiveEntry entry in zipArchive.Entries)
                            {
                                using (Stream entryStream = entry.Open())
                                using (FileStream fileStream = File.OpenWrite(string.Format("{0}/{1}", targetDirectory, entry.FullName)))
                                {
                                    entryStream.CopyTo(fileStream);
                                }
                            }
                        }
                    
         

        }
purushotham
Top achievements
Rank 1
 asked on 09 Aug 2023
1 answer
141 views

I've searched and searched and I cannot find any information around using Telerik.Documents.Fixed with PDF's that have XFA forms.   Is this possible?   And if so is there any sample code showing how to do it?

Thanks.

 

Yoan
Telerik team
 answered on 21 Jul 2023
1 answer
73 views

I do notice that the AutoFitHeight works fine when I'm dealing with only a single row without any merged cells.

I have a situation where I have a merged cell which is the combination of cells from the same row (i.e. B2-B5).  When trying to use AutoFitHeight, there is no change to the row height.

Is there anything I could do? 

Yoan
Telerik team
 answered on 18 Jul 2023
1 answer
50 views

We have a scenario where the client is wanting a combobox in a generated Word document to have the color of the combobox change depending on the option selected (these combo boxes are repeated many times in the document so the colour change is important to the client.

Screenshot shows  the Combobox in use. Below is the snippet of my code. Is there a way to do what I am after?

RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
// In my source (an html document that was converted to a Word Document higher in the code) "#ddlApplies" is where I need to place a ComboBox
// It is in a table cell.
ReadOnlyCollection<FindResult> findResults = editor.FindAll("#ddlApplies", matchCase: false, matchWholeWord: false);
foreach (var item in findResults)
{
	string foundVal = item.Runs[0].Text.Replace("#", "");
	// The full run name consists of "#ddl|Identifier". In Furture dev we will use the Identifier (which is put in as the alias) to identify which control this is so we can read in the document and update other datasets
	//var ddlContentControl = editor.InsertStructuredDocumentTag(SdtType.ComboBox);
	ComboBoxProperties properties = new ComboBoxProperties();
	// Complies --- Green
	// Does not Comply --- Red
	// Minor Variation --- Orange
	// N/A -- Grey
	properties.Items.Add(new ListItem() { DisplayText = "Complies", Value = "Complies" });
	properties.Items.Add(new ListItem() { DisplayText = "Does not Comply", Value = "Does not Comply" });
	properties.Items.Add(new ListItem() { DisplayText = "Minor Variation", Value = "Minor Variation" });
	properties.Items.Add(new ListItem() { DisplayText = "N/A", Value = "N/A" });
	// Setting the alias with the identifier.
	properties.Alias = foundVal.Split("|")[1];
	properties.Lock = Lock.SdtLocked;
	properties.Placeholder = new Placeholder() {
		PlaceholderText = "Select",
		ShowPlaceholder = true
	};
	properties.OutlineAppearance = OutlineAppearance.BoundingBoxes;
	//setting the properties
	properties.RunProperties.CopyPropertiesFrom(item.Runs[0].Properties);
	/***
	Here is where I think I need to set things. But not sure how. Client wants each option to have a different colour. They would prefer the whole cell to change, but happy if I can just get the ComboBox to change.
	
	***/
	
	//inserting the Tag and setting the default value
	editor.MoveToInlineStart(item.Runs[0]);	
	editor.InsertStructuredDocumentTag(properties, item.Runs[0], item.Runs[0]);
	item.Runs[0].Text = "Select";	

}

Vladislav
Telerik team
 answered on 17 Jul 2023
1 answer
56 views

How can I install the document library alone without installing a component UI library?

I just want to process PDF files

Yoan
Telerik team
 answered on 13 Jul 2023
1 answer
83 views
I want to learn more about Word processing and how to create tables in the Word document.
Unfortunately I only ever see c# code.
Can someone show me an example for VB.NET ?
A simple table with cell contents..
Yoan
Telerik team
 answered on 13 Jul 2023
1 answer
242 views


Hi all, 

I got some problems when I try to read my Excel file as below:

1. It skipped the null cells, it only read data at the cells having value. For example in my case, after reading cell 2 at row 2, it jumped to cell 14. 

2. It showed the error message "The given key '3' was not present in the dictionary." at cell 15

You can see my code, the Excel file I used, and the result in below

My code

@page "/testpage"
@using Telerik.Documents.SpreadsheetStreaming;
<div>
    @((MarkupString)(str.ToString()))
</div>


@code {
    private StringBuilder str = new StringBuilder();
    protected override void OnInitialized()
    {
        str = ReadData();
    }
    private StringBuilder ReadData()
    {

        try
        {
            string filename = ".\\Template.xlsx";
            using (FileStream fs = new FileStream(filename, FileMode.Open))
            {
                using (IWorkbookImporter workBookImporter = SpreadImporter.CreateWorkbookImporter(SpreadDocumentFormat.Xlsx, fs))
                {
                    foreach (IWorksheetImporter worksheetImporter in workBookImporter.WorksheetImporters)
                    {
                        foreach (IRowImporter rowImporter in worksheetImporter.Rows)
                        {
                            foreach (ICellImporter cell in rowImporter.Cells)
                            {
                                if(cell.Value!= null)
                                {
                                    str.Append(cell.Value.ToString());

                                }
                                else
                                {
                                    str.Append("NULL");
                                }
                                str.Append(",");
                            }
                            str.Append("<br/>");
                        }

                    }
                }
            }
            return str;
        }
        catch(Exception ex)
        {
            str.Append("<br/>");
            str.Append(ex.Message);
            return str;
        }

    }
}
 My Excel file as a picture below, I also attached my Excel in the question (Template.rar)

  The result when I run 

  Everyone who know how to fix it, please help me.

Thank you

Yoan
Telerik team
 answered on 04 Jul 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?