How to save pdf with TextBoxes in ASP.NET - c#

I want to save my gridview in pdf.
The point is that all the cells, except the header row (columns title) and the first column (rows title), have to be PDF textboxes, so once I open the file I can write text inside.
How can I do it?
I have found that it is possibe to create a pdf with textfields but I have not found a way to make them in a specific part of the sheet.
I have tried to do so: Link 1

Related

How to save OLEObject pdf file from excel

I have an excel file and one cell of every row contain embed pdf file object and remaining cells contain string values. Excel file looks like click here
I want to save this excel file data in sql database table, I can read the cell data of Date, Store, Category, Cost, Total, Method columns using oledb provider or using Workbook and Worksheet classes and save it in database table fine.
but coming to the Receipt column it showing null value when reading from either oledb or worksheet,
I want to save embedded object in local folder row wise and get filepath
Insert excel row data and for 'Receipt' column I need to save filepath
I will show this data in grid, for Receipt column I will set hyperlink and give filepath, so user can view the pdf that saved of that row.
How to implement using "Microsoft.Office.Interop.Excel" namespace and "OLEObject" class.
Any ideas please share it will helpful, I dont want to use third pary assembly references like GemBox, Aspose, etc.
Thanks,
Ajay

How to not skip empty cell in Excel when creating .csv file

hope you guys can help!
I am trying to create .csv out of Excel which would have columns A - H filled with some data I want to read but data is optional. So some times the first column A can be empty. Now, when I save the .csv, unless I entered one space in the A column, Excel automatically trims A column, and the result is 7 cells to read A - G instead 8 cells A - H (with A column) being "empty". I would like to save client the trouble of needing to enter one space or -> ="" in the Excel formula to make first or last column "empty" but not trimmed in the resulting .csv.
Thank you!
There is no option in Excel to preserve empty columns, when exporting to .csv. But you could introduce a header text in the first row, so you will always have the columns filled atleast with the header text.
Plus it would make your data probably more readable, depending on what data this is.
Another possibility would be to implement a makro and embedd a button in your excel file:
see
how not to skip empty first cell when saving as .CSV?

Tab Delimited Text Copy Paste To Excel

I am generating a block of text via C# Stringbuilder, with appropriately tab-delimited text (new lines, "\t", etc.) and displaying the text within a tag in my web application. If I copy/paste this to Excel, all the text pastes into the first column on the spreadsheet.
If I copy the outerHTML of the block (Chrome) or copy/paste into Notepad++ and THEN paste to Excel, all the data pastes neatly into individual cells - which is the desired outcome of this effort. Can anyone tell me what I need to do in order to be able to copy the text from my application and paste it into Excel, so that the text pastes into individual cells (ie, keeps the tab-delimited format)?
Unfortunately, it appears an extra step is required.
The default behaviour of paste in Excel (& many other applications) is to use the original format of the contents of the clipboard.
Copying from a web application/HTML page will result in the clipboard contents being flagged as HTML. The clipboard contents will have the tab character, but as HTML renders tabs to whitespace (compacting to a single whitespace if there are multiple tabs) - just using control-V will convert the tabs to spaces & the contents will appear in a single cell when pasting into Excel..
You will need to use the "Paste Special" option & select "Unicode text" to retain the tabs. There is no way to set this by default : https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_windows8-mso_365hp/how-to-change-default-paste-behavior-with-ctrl-v/f58da075-8fd5-4c80-a64b-5e71ec8ad38b?auth=1
Copying the outerHTML of Chrome sets the clipboard format to text in the first place, pasting to Notepad++ does paste as text rather than HTML then recopying sets the format to text - which is why these methods work.
I was able to paste to Excel and keep the format by changing the element my text wrote to from a div to textarea. Copy/paste of tsv from textarea to a tab-delimited Excel spreadsheet keeps the data formatted in tabular format when pasted. Thanks all for the help.
Try this ,
Before pasting data set excel's text to column delimiters to space and try to paste your values again.
Old topic but I had this. Need to copy something each day from a programme which outputs to google chrome browser. Whenever it was copied and pasted into excel it was going into 1 cell. Yet if I control all and paste it was ok.
I found you can copy only the lines you want and it will behave as wanted - if you don't drag the cursor all the way down off the page. ie if you highlight down to the last piece of information in the bottom right of screen more carefully, when you past to excel it pastes it as tab separated. Whereas if you drag it right down it pastes it all in 1 cell. Might help someone in the future who has this.
You can use 'text to columns' in Excel to format the data in the way you want it to.
After pasting the data into excel, select the column with your data.
Go to Data - click 'Text to columns'
Choose delimited and hit next
Choose Tab and hit finish.
If you don't want to use this extra step, the following works for Excel 2013:
Go to Home, Paste options and click 'Use text import wizard'
Choose delimited and hit next
Choose Tab and hit finish.

How to display headers on multiple pages using syncfusion

I have a table report which will be exported as a word document. I can print out the header in the first page only. It doesn't seem to carry over to the next page. Can anyone tell me how I can show the header data on all the pages of the word document?
The solution to this was a lot easier than I expected. All I had to do was put the header data I wanted in the header of the Word Ddocument Template that I wanted to use. Also in order to have the header of a table to apear repeatedly when there are multiple pages, again we go to the Word Document Template, select the rows you want to use as headers then right click and go to Properties -> Rows tab -> enable(check) "Reapeat as header row at the top of each page" -> click OK and save. That should do the trick!! Then use syncfusion as you usually use it to populate the table. When the data exceed to more than one page the header will be repeated on the following pages.

How to delete the content from text file while deleting from datagridview

I am having a datagridview where the content of that datagridview will be from my sample text file. When i click on load i will have the data from sample.txt and that data in that text file is shown in the datagridview. I will have a checkbox column in my datagridview. If the user checks i will select the row and when user clicks delete button i would like to delete that text from the text file.
Suppose my text is as follows
If i click on the check box of first row and click on delete i would like to delete that text from text file
textfiles - How to delete a line from a text file in C#? - Stack ...
How to delete a line from a text file in C#?
See this link .
And some comments from me Here.
Read the all lines search the text u want and delete that text from list and write it in text file.
How about using the Text OBDC or OLE DB to access the text file contents?
You will have to:
Decide from FixedLength, Delimited/etc, for the Text File Driver.
Create a Schema Driver.
Use the connection string to access the file.
Use simple oledb commands to process the data in file. Or use a data adapter.
string sql = "DELETE FROM yourFile WHERE ID=" + ID;
ExecuteNonQuery(sql);

Categories