如何打印集合反向格式为我的项目 [英] How can u print the collection reverse Format For My project

查看:58
本文介绍了如何打印集合反向格式为我的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了这个项目。在这里我想以反向格式打印集合



例如Ramesh是字符串但反向打印hsemaR。以同样的方式我想要



以反向格式打印该系列。



我的代码:



I had Developed the project .in this i want to print the collection in reverse Format

For example "Ramesh" is string But reverse Printing "hsemaR".in this same way i want to

print the collection in reverse Format.

My code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace test
{
    public partial class Form1 : Form
    {
        string filename;
        string path;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.CheckFileExists = true;
            openFileDialog.AddExtension = true;
            openFileDialog.Filter = "PDF files (*.pdf)|*.pdf";
            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                //data1 = openFileDialog.FileNames.Select(x => new FileInfo(x)).ToArray();
                filename = Path.GetFileName(openFileDialog.FileName);
                path = Path.GetDirectoryName(openFileDialog.FileName);
                textBox1.Text = path + "\\" + filename;

            }
        }
        public static string ExtractTextFromPdf(string filename)
        {
            using (PdfReader r = new PdfReader(filename))
            {
                StringBuilder text = new StringBuilder();

                for (int i = 1; i <= r.NumberOfPages; i++)
                {
                    text.Append(PdfTextExtractor.GetTextFromPage(r, i));
                }

                string first = text.ToString();
                return first;
            }
        }

      private void button3_Click(object sender, EventArgs e)
      {
          string s=  Form1.ExtractTextFromPdf(textBox1.Text);
      }
    }
}







button3是打印按钮



string s包含pdf文件数据。



i想以反向字符串格式打印Pdf文件数据在richtextbox







请帮帮我



谢谢你




button3 is print button

string s contain pdf file data.

i want to print the Pdf file data in reverse string format in richtextbox



please help me

thank u

推荐答案

看看 this [ ^ ]



Look at this[^]

string reverseValue = new string(s.Select((c, index) => new { c, index })
                                         .OrderByDescending(x => x.index)
                                         .Select(x => x.c)
                                         .ToArray());


这篇关于如何打印集合反向格式为我的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆